CustomerRepository

Namespace: Babel.Data Assembly: Babel.Data.dll

A customer repository.

public class CustomerRepository : GenericRepository<Customer>, ICustomerRepository, IGenericRepository<Customer>

Inheritance

objectGenericRepository<Customer>CustomerRepository

Implements

ICustomerRepository, IGenericRepository<Customer>

Inherited Members

GenericRepository<Customer>.Get(Expression<Func<Customer, bool>>, Func<IQueryable<Customer>, IOrderedQueryable<Customer>>, string, string, int?, int?), GenericRepository<Customer>.GetAsync(Expression<Func<Customer, bool>>, Func<IQueryable<Customer>, IOrderedQueryable<Customer>>, string, string, int?, int?, CancellationToken), GenericRepository<Customer>.QueryAsync(string, string, string, string, int?, int?, CancellationToken), GenericRepository<Customer>.GetById(params object[]), GenericRepository<Customer>.GetByIdAsync(params object[]), GenericRepository<Customer>.GetByIdAsync(object[], CancellationToken), GenericRepository<Customer>.CountAsync(Expression<Func<Customer, bool>>, CancellationToken), GenericRepository<Customer>.CountAsync(string, CancellationToken), GenericRepository<Customer>.Insert(Customer), GenericRepository<Customer>.InsertAsync(Customer, CancellationToken), GenericRepository<Customer>.Update(Customer), GenericRepository<Customer>.Delete(params object[]), GenericRepository<Customer>.Delete(Customer), GenericRepository<Customer>.Save(), GenericRepository<Customer>.SaveAsync(CancellationToken), GenericRepository<Customer>.DbSet, GenericRepository<Customer>.Context, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

CustomerRepository(BabelDbContext)

Initializes a new instance of the CustomerRepository class.

public CustomerRepository(BabelDbContext context)

Parameters

NameDescription

The database context.

Methods

Delete(IEnumerable<int>)

Deletes the given list of customers from the repository. Begins tracking the given entities in the Detached state such that they will be deleted in the database when SaveChanges() is called.

public void Delete(IEnumerable<int> customerIds)

Parameters

NameDescription

customerIds IEnumerable<int>

The customer Identifiers to delete.

GetAsync(DateTime?, DateTime?, int?, int?, string, string)

Asynchronously gets a list of customers from this repository.

public Task<List<Customer>> GetAsync(DateTime? start, DateTime? end, int? skip, int? take, string include = "", string orderBy = "")

Parameters

NameDescription

start DateTime?

(Optional) Specifies a filter for customer created after a given start date.

(Optional) Specifies a filter for customer created before a given end date.

skip int?

(Optional) The number of records to skip before the first record found.

take int?

(Optional) The number of records to take after the first record found.

include string

(Optional) A comma separated list of nested entity names to retrieve.

orderBy string

(Optional) Order by expression.

Returns

NameDescription

A task that represents the asynchronous get operation. The task result contains the list of customers found.

GetByCodeAsync(string)

Asynchronously gets the Customer with the given code value. If no Customer entity is found in the context or the store, then null is returned.

public Task<Customer> GetByCodeAsync(string code)

Parameters

NameDescription

code string

The customer code of the customer to be found.

Returns

NameDescription

A task that represents the asynchronous get operation. The task result contains the Customer found, or null.

GetByIdAsync(params object[])

Asynchronously gets an entity with the given primary key values. If an entity with the given primary key values exists in the context, then it is returned immediately without making a request to the store. Otherwise, a request is made to the store for an entity with the given primary key values and this entity, if found, is attached to the context and returned. If no entity is found in the context or the store, then null is returned.

public override Task<Customer> GetByIdAsync(params object[] ids)

Parameters

NameDescription

ids object[]

The values of the primary key for the entity to be found.

Returns

NameDescription

A task that represents the asynchronous get operation. The task result contains the Customer found, or null.

GetLicensesByCustomerCodeAsync(string)

Asynchronously gets the Licenses for a given Customer code.

public Task<IList<License>> GetLicensesByCustomerCodeAsync(string code)

Parameters

NameDescription

code string

The customer code.

Returns

NameDescription

A task that represents the asynchronous get operation. The task result contains the list of Licenses found, or null.

GetOrdersByCustomerCodeAsync(string)

Asynchronously gets the orders for a given customer code.

public Task<IList<Order>> GetOrdersByCustomerCodeAsync(string code)

Parameters

NameDescription

code string

The customer code.

Returns

NameDescription

A task that represents the asynchronous get operation. The task result contains the list of Order found, or null.

GetProductsByCustomerCodeAsync(string)

Asynchronously gets the Products for a given Customer code.

public Task<IList<Product>> GetProductsByCustomerCodeAsync(string code)

Parameters

NameDescription

code string

The customer code.

Returns

NameDescription

A task that represents the asynchronous get operation. The task result contains the list of Product found, or null.

Last updated