[英]Dynamics CRM: Problem with Composite Key Join in LINQ
I have following query in LINQ to LEFT JOIN same entity:我在 LINQ 中有以下查询到 LEFT JOIN 相同的实体:
query = from a in orgSvcContext.CreateQuery("entity1")
join b in orgSvcContext.CreateQuery("entity1")
on new { v1 = a["field1"], v2 = a["field2"] } equals new { v1 = b["field2"], v2 = b["field1"] } into gr
from c_joined in gr.DefaultIfEmpty()
where c_joined["field0"] == null && (a["field1"].Equals(new Guid(@param)) || a["field2"].Equals(new Guid(@param)))
select a;
It complains the following error:它抱怨以下错误:
invalid 'join' condition.
无效的“加入”条件。 an entity member is invoking an invalid property or method
实体成员正在调用无效的属性或方法
I refer from here: https://docs.microsoft.com/en-us/dotnet/csharp/linq/join-by-using-composite-keys我从这里参考: https://docs.microsoft.com/en-us/dotnet/csharp/linq/join-by-using-composite-keys
Anything wrong with my JOIN
?我的
JOIN
有什么问题吗? I have no problem if I just use如果我只是使用,我没有问题
on a["field1"] equals b["field2"]
Thanks in advance.提前致谢。
The new { v1 = a["field1"], v2 = a["field2"] }
construct cannot be resolved to an attribute name. new { v1 = a["field1"], v2 = a["field2"] }
构造无法解析为属性名称。
The LINQ implementation for Dynamics CRM is very limited as it attempts to convert LINQ expressions into QueryExpression
queries. Dynamics CRM 的 LINQ 实施非常有限,因为它试图将 LINQ 表达式转换为
QueryExpression
查询。 These queries in turn only implement a basic subset of the SQL language.这些查询又只实现了 SQL 语言的一个基本子集。
When joining two entities make shure that after the on
the left and right side can be resolved to existing lookup attributes of both entities.当加入两个实体时,请确保
on
左侧和右侧之后可以解析为两个实体的现有查找属性。
Still keep in mind not all QueryExpression
capabilities can be used in LINQ queries.请记住,并非所有
QueryExpression
功能都可以在 LINQ 查询中使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.