Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Dynamics CRM: Problem with Composite Key Join in LINQ

$
0
0

Hello,

I have following query in LINQ to LEFT JOIN same entity:

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

Anything wrong with my 'JOIN'? I have no problem if I just use:

on a["field1"] equals  b["field2"]

Thanks in advance.


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images