您的位置:首页 > 移动开发 > Objective-C

Comparison of user class objects is not supported in Linq to entities

2008-05-10 09:12 549 查看
The linq expression is:

var query = from p in _db.LogProjects

where p.Well == well

select p;

( Well is a user class )

An exception will be thrown:

Unable to create a constant value of type 'Closure type'. Only primitive types (for instance Int32, String and Guid) are supported in this context.

So, you can change the linq expression to:

var query = from p in _db.LogProjects

where p.Well.WellID == well.WellID

select p;

reference:

ADO.NET Entity Framework Comparison Frustration

Entity Framework Comparison Frustration: Explained
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐