An implementation of M.Repository abstraction using EntityFramework.
- Inherit
Entity<TKey>
in order to useIRepository<TEntity>
.
example:
public class Item : Entity<int>
{
public string InventoryNumber { get; set; }
public int Quantity { get; set; }
}
- Setup repositories and unit of work with concrete implementations.
example (pseudo code):
For<IRepository<>>().Use<Repository<>>();
For<IUnitOfWork>().Use<UnitOfWork>();
- To use asynchronous queries setup
QueryableAsyncExtensionsProxy
withEfQueryableAsyncExtensions
.
example:
QueryableAsyncExtensionsProxy.Initialize(new EfQueryableAsyncExtensions());