A Generic Entity Framework 6 data repository for .NET 4.5 supporting both sync and async methods
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
BaseService.cs
LICENSE
README.md

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);
}