Unable to translate lambda expression 'entDocEntity => ((entDocEntity.Interfaces != null) AndAlso entDocEntity.Interfaces.Any(entMlInterfaces => ((entMlInterfaces.Linked != null) AndAlso value(System.Collections.Generic.List`1[System.Guid]).Contains(entMlInterfaces.Linked.Id))))' because it requires to materialize entity of type 'Werp.Model.Models.Documents.DocEntity'.

The code:

var lst = new List<Guid>() { new Guid("b85c43db-15c2-416a-b512-02c5fa892d64") };
var d = Query.All<DocEntity>().Where(ent => ent.Interfaces != null && ent.Interfaces.Any(ent2 => ent2.Linked != null && lst.Contains(ent2.Linked.Id))).ToArray();

ent.Interfaces - is EntitySet<ent2> If I remove ent.Interfaces != null and ent2.Linked != null - then it translates normally. But this Expression is generated, and we need those "!= null" operands, because we use these expression in runtime not only for SQL queries


Updated at 16.07.2010 13:42:33

Well, I suppose you sould do it as you wish) As for me i would just not translate this into sql

This thread was imported from our support forum. The original discussion may contain more detailed answer.

asked Jul 15 '10 at 10:02

xumix's gravatar image

xumix
425757682

I.e. we should enable translation of someEntity.EntitySet == / != null expression as always false / true?

(Jul 15 '10 at 10:02) Alex Yakunin Alex%20Yakunin's gravatar image

One Answer:

Issue: http://code.google.com/p/dataobjectsdot ... ail?id=751

I set priority to medium - as far as I can judge, you can workaround this by processing the expression (is this really possible?).

answered Jul 16 '10 at 15:29

Alex%20Yakunin's gravatar image

Alex Yakunin
29714412

Well, it possible, but not likely)

(Jul 16 '10 at 15:29) xumix xumix's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×573

Asked: Jul 15 '10 at 10:02

Seen: 6,369 times

Last updated: Jul 15 '10 at 10:02

powered by OSQA