A Generic Entity Framework 6 data repository for .NET 4.5 supporting both sync and async methods
C#
Latest commit aa59b52 Oct 1, 2015 @mombrea mombrea Merge pull request #3 from CypressNorth/revert-2-master
Revert "Extended Project with Interface and additions"

README.md

.NET-EF6-GenericRepository

A Generic Entity Framework 6 data repository for .NET 4.5 supporting both sync and async methods

Usage

Include the BaseService.cs class in your application and set the appropriate namespace.

Inherit from BaseService in your Service classes and initialize the constructor and base constructor with a data context.

public class CategoryService : BaseService<Category>
{
    public CategoryService(MyDataContext context)
        : base(context)
    { }
}

Overrides

Override the base methods as needed by declaring the same method as new

public new async Task<Category> GetAsync(int id)
{
    return await _context.Categories.SingleOrDefaultAsync(x => x.categoryID == id);
}