-
Notifications
You must be signed in to change notification settings - Fork 13
Select Operations
Furkan Güngör edited this page Jun 20, 2022
·
3 revisions
You can run your select expressions with EasyRepository
.
public class MyClass
{
private readonly IUnitOfWork _unitOfWork;
public MyClass(IUnitOfWork unitOfWork)
{
_unitOfWork = unitOfWork;
}
public async Task<object> GetSelectableMultipleAsync()
{
var entities = await _unitOfWork.Repository.GetMultipleAsync<Author, object>(asNoTracking: false, projectExpression: select => new
{
SelectName = select.Name,
SelectDate = select.CreationDate
});
return entities;
}
}
public class MyClass
{
private readonly IUnitOfWork _unitOfWork;
public MyClass(IUnitOfWork unitOfWork)
{
_unitOfWork = unitOfWork;
}
public async Task<object> GetFilterableAndIncludeableMultipleAsync()
{
Func<IQueryable<Author>, IIncludableQueryable<Author, object>> include = a => a.Include(i => i.Books);
var entities = await _unitOfWork.Repository.GetMultipleAsync<Author, object>(asNoTracking: false, whereExpression: a=>a.IsDeleted == false, includeExpression: include, projectExpression: select => new
{
SelectName = select.Name,
SelectDate = select.CreationDate
});
return entities;
}
}
Welcome to the EasyRepository.EFCore
wiki!
Topics:
-
Getting Started
-
Implementations
-
Specification
-
Ardalis.Specification & EasyRepository.EFCore