【发布时间】:2016-06-30 12:10:37
【问题描述】:
当我这样做时:
var db = new NotentoolEntities();
IQueryable<GroupOfBranches> queryGOB = db.tabGroupOfBranches.Cast<GroupOfBranches>().Where(x => x.intGroupID.Equals(ID));
List<GroupOfBranches> GOB = new List<GroupOfBranches>(queryGOB); //here is the error
我遇到以下错误:
A first chance exception of type 'System.NotSupportedException' occurred in EntityFramework.SqlServer.dll
【问题讨论】:
-
entityframework 不支持的 Equals 函数可能存在问题..
-
在
Where()之后调用ToList()可能更清楚 -
我的错误在第三行,但我也尝试替换 Equals 并得到同样的错误
-
你为什么要投到 GroupOfBranches?
-
因为我需要返回这个对象
标签: c# linq exception iqueryable