3
我有以下查询在数据库中调用包含通过“直接事件,这些线路的方法时,返回选择通过LINQ最后一个记录失败,
using (Entities ent = new Entities())
{
Loaction last = (from x in ent.Locations select x).Last();
Location add = new Location();
add.id = last.id+1;
//some more stuff
}
以下错误选择的最后一个记录“不能识别方法” “关于ext.net:
LINQ to Entities does not recognize the method 'Prototype.DataAccess.Location Last[Location]
(System.Linq.IQueryable`1[Prototype.DataAccess.Location])' method,
and this method cannot be translated into a store expression.
表结构如下:
int ident IDENTITY NOT NULL,
int id NOT NULL,
varchar(50) name NULL,
//some other varchar fields
看看这个问题:http://stackoverflow.com/questions/7293639/linq-to-entities-does-not-recognize-the-method-last-really – 2013-03-05 08:56:00