GenericRepository is a data access library using repository pattern.
Some of the features of GenericRepository are:
- Build-in paging feature
- Implement Unit of Work pattern
- Support different Entity key types
Install-Package GenericRepository.EF6
- Annotate key property in entity classes with [Key] attribute
- Get the repository object and call functions:
var _uowProvider=new UowProvider();
using (var uow = _uowProvider.CreateUnitOfWork<AppContext>())
{
var repository = uow.GetRepository<Department>();
foreach (var item in buildings)
{
repository.Add(item);
}
await uow.SaveChangesAsync();
}
All source code is licensed under MIT license - http://www.opensource.org/licenses/mit-license.php