I have my own repository that is as follows. However this does not take into account some of the new features such as the range features. Does anyone have a repository that
Take a look at Generic Unit of Work & Repositories Framework. You can download the entire repository project, modify the code to include the range functions, implement it in your own solution, etc.
Here's an example of its usage in the context of an OData/WebAPI controller method returning a DTO, rather than the EF entity.
var results = odataQueryOptions.ApplyTo(_uow.Repository()
.Query()
.Get()
.Include(u => u.User)
.Where(u => u.UserId == userId)
.OrderBy(o => o.Description)).Cast()
.Select(x => new ContentTypeDTO()
{
//projection goes here
ContentTypeId = x.ContentTypeId,
Description = x.Description,
UserDTO = new UserDTO
{
UserId = x.UserId,
UserName = x.User.UserName
}
});
Hope that helps.