我正在使用Entity Framework(代码优先),如下所示:
IQueryable<StammdatenEntityModel> query = dbSet;
query.OrderByDescending(s => s.CreateDateTime);
query.Where(s => s.Deleted == false);
if(!String.IsNullOrEmpty(keyword))
{
query.Where(s => s.SerialNumber.Contains(keyword)); //simplified for SO
}
query.Skip(skip);
query.Take(take);
但OrderByDescending
,Where
,Skip
和Take
不会产生任何影响。
答案 0 :(得分:2)
您没有使用查询结果
IQueryable<StammdatenEntityModel> query = dbSet;
query = query.OrderByDescending(s => s.CreateDateTime);
query = query.Where(s => s.Deleted == false);
if(!String.IsNullOrEmpty(keyword))
{
query = query.Where(s => s.SerialNumber.Contains(keyword)); //simplified for SO
}
query = query.Skip(skip);
query = query.Take(take);