我的 LINQ 查询结果不正确,但当我分析生成的 SQL 时,SQL 结果是正确的。
ApplicationsEntities context = new ApplicationsEntities();
var query = from documentation in context.Documnetations
where documentation.Application_Version_ID == app_ver_id
orderby documentation.Name
select documentation;
docs = query.ToList<Documnetation>();
I get back two duplicates : "How to install Office 2003" and "How to install office 2003"
Below is the output of the profiled SQL:
生成的 SQL 结果的分配会发生什么情况?
根据评论更新
您的 linq 查询很好,但是在您的模型中您必须设置主键/实体键
Linq 到 Sql
In your dbml
,您需要将主键更改为Application_Version_ID
to Documentation_Id
实体连接
In your model
,您需要将实体密钥更改为Application_Version_ID
to Documentation_Id
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)