public class GetAllTasksInput : PagedAndSortedResultRequestDto
{
    public TaskState? State { get; set; }
}
public class TaskAppService : AsyncCrudAppService<Task, TaskDto, int, GetAllTasksInput>
{
    public TaskAppService(IRepository<Task> repository)
        : base(repository)
    {

    }

    protected override IQueryable<Task> CreateFilteredQuery(GetAllTasksInput input)
    {
        return base.CreateFilteredQuery(input)
            .WhereIf(input.State.HasValue, t => t.State == input.State.Value);
    }
}

分页:
http://www.cnblogs.com/sheng-jie/p/6337426.html
https://github.com/dncuug/X.PagedList

参考:
https://aspnetboilerplate.com/Pages/Documents/Application-Services
https://docs.microsoft.com/en-us/aspnet/core/data/ef-rp/sort-filter-page?view=aspnetcore-2.2

相关文章:

  • 2021-10-11
  • 2021-06-15
猜你喜欢
  • 2021-12-09
  • 2021-08-16
  • 2022-12-23
  • 2021-11-10
  • 2021-10-25
  • 2021-06-11
  • 2022-12-23
相关资源
相似解决方案