April 2018
Intermediate to advanced
300 pages
7h 41m
English
We will create a generic repository interface that will be implemented by each service's repository class, as each service will be following a DDD approach and has its own repository to give meaningful information to the developer based on the business domain. In this interface, we can keep generic methods such as All and Contains and a property to return UnitOfWork:
public interface IRepository<T> where T : BaseEntity
{
IUnitOfWork UnitOfWork { get; }
IQueryable<T> All<T>() where T : BaseEntity;
T Find<T>(Expression<Func<T, bool>> predicate) where T : BaseEntity;
bool Contains<T>(Expression<Func<T, bool>> predicate) where T : BaseEntity;
}
Read now
Unlock full access