I am reading this tutorial. I want to use async
query with EF Core.
It works well when i use like this:
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();
but i want to use whereif and orderby like
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();
Error:
'IOrderedEnumerable' does not contain a definition for 'ToListAsync' and no extension method 'ToListAsync' accepting a first argument of type 'IOrderedEnumerable' could be found (are you missing a using directive or an assembly reference?)