Код: Выделить всё
var query = _context.TableName
.AsQueryable();
query = query.ApplyOrdering(queryObj, columnsMap);
// This doesn't work, disposes DbContext and exits
result.TotalItems = await query.CountAsync();
query = query.ApplyPaging(queryObj);
result.Items = await query.ToListAsync();
var query = _context.TableName
.AsQueryable();
query = query.ApplyOrdering(queryObj, columnsMap);
result.TotalItems = query.Count(); // Works
query = query.ApplyPaging(queryObj);
result.Items = query.ToList(); // Works
Спасибо
Подробнее здесь: https://stackoverflow.com/questions/791 ... ount-works
Мобильная версия