嗨,我刚开始学习LINQ和一直在试图了解TakeWhile使用中的LINQ查询中使用TakeWhile
在这里,我已经试过这样的事情
using ( var db = new OrchestrateDataEntities())
{
var y = db.Set<Rulebook_Mapping>();
var xyz = y.TakeWhile(x => x.ID == 2).AsQueryable();
foreach (var item in xyz)
{
Console.WriteLine(item.ID);
}
}
Console.ReadKey();
,然后来到错误
LINQ to Entities does not recognize the method 'System.Linq.IQueryable`1[ConFW.Rulebook_Mapping] TakeWhile[Rulebook_Mapping](System.Linq.IQueryable`1[ConFW.Rulebook_Mapping], System.Linq.Expressions.Expression`1[System.Func`2[ConFW.Rulebook_Mapping,System.Boolean]])' method, and this method cannot be translated into a store expression.
只是好奇你为什么需要.AsQueryable() –
它没有没有工作,并没有用过,虽然只是用它 – Vivekh