我正在阅读本教程.我想使用asyncEF Core查询.
当我使用这样的时候它很好用:
var tasks = await _taskRepository
.GetAll()
//.WhereIf(!string.IsNullOrEmpty(input?.Title), x => x.Title.Contains(input.Title))
//.WhereIf(input?.State != null, x => x.State == input.State.Value)
//.OrderByDescending(x => x.CreationTime)
.ToListAsync();
Run Code Online (Sandbox Code Playgroud)
但我想使用whereif和orderby之类的
var tasks = await _taskRepository
.GetAll()
.WhereIf(!string.IsNullOrEmpty(input?.Title), x => x.Title.Contains(input.Title))
.WhereIf(input?.State != null, x => x.State == input.State.Value)
.OrderByDescending(x => x.CreationTime)
.ToListAsync();
Run Code Online (Sandbox Code Playgroud)
错误:
'IOrderedEnumerable'不包含'ToListAsync'的定义,并且没有可以找到接受类型'IOrderedEnumerable'的第一个参数的扩展方法'ToListAsync'(您是否缺少using指令或程序集引用?)