Skip to content

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

License

Notifications You must be signed in to change notification settings

CypressNorth/.NET-EF6-GenericRepository

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages