-
Notifications
You must be signed in to change notification settings - Fork 13
Count Operations
Furkan Güngör edited this page Jun 20, 2022
·
2 revisions
Count
queries can be run with EasyRepository
.
public class MyClass
{
private readonly IUnitOfWork _unitOfWork;
public MyClass(IUnitOfWork unitOfWork)
{
_unitOfWork = unitOfWork;
}
public async Task<int> CountAsync()
{
return await _unitOfWork.Repository.CountAsync<Author>();
}
}
public class MyClass
{
private readonly IUnitOfWork _unitOfWork;
public MyClass(IUnitOfWork unitOfWork)
{
_unitOfWork = unitOfWork;
}
public async Task<int> CountWithClassicWhereAsync()
{
return await _unitOfWork.Repository.CountAsync<Author>(a=>a.Surname.Contains("t"));
}
}
public class MyClass
{
private readonly IUnitOfWork _unitOfWork;
public MyClass(IUnitOfWork unitOfWork)
{
_unitOfWork = unitOfWork;
}
public async Task<int> CountWithAutoFiltererAsync(AuthorFilterDto dto)
{
return await _unitOfWork.Repository.CountAsync<Author, AuthorFilterDto>(dto);
}
}
Welcome to the EasyRepository.EFCore
wiki!
Topics:
-
Getting Started
-
Implementations
-
Specification
-
Ardalis.Specification & EasyRepository.EFCore