Invoke an Expression in a Select statement - LINQ to Entity Framework -
I'm already trying to use an existing expression building class which I tried to do a select clause. I was not sure how to give expression to the expression tree for selection, I tried to do the following:
var catalog = match list. Selection (c = & gt; new {c.CatalogID, name = units, expansion helper} Make-Transaction Expression & Lt; Catalog & gt; ("Name", ApplicationContacts.Instant.content LanguageID) .compile (). (C) CategoryName = Institutions Expert at the Make Translation Liquid Experiment & lt; Category & gt; ("Name", ApplicationContext.Instance.CurrentLanguageID.). Invoke (C. category), c. Credits, c. Startdatty, c. Indentuate)};
But I get an error that the unit framework can not enter a SQL method. Is there any way to work on this?
FYI, Entity ExecutionHelper. Macronsulation Exercise & lt; T & gt; (String name, input language id):
x = & gt; X.Translations.Count (t = & gt; t.LanguageID == languageID) == 0? X.Translations.Count () & gt; 0? Name: "": x.Translations.FirstOrDefault (t = & gt; t.LanguageID == languageID) .name
Edit: I know that I need it to complete this To use an Expression Visitor, but I'm not sure how to use an Expression Visitor to change Member Interaction, so if someone knows how to complete it, then let me know.
You have to capture expressions in Wars. You will not be able to use anonymous types The general idea is that it works:
expression & lt; Funk & lt; Foo, Bar & gt; & Gt; Exp = GenExpression (); Var q = match list Selection (exp);
But this will not happen:
var q = match list Select (Jane Expression);
for the first time results from GenExpression
to L2E happily passes second, instead of result Jane Express
tries to pass.
So you need a reference type of the same type of expression. The type contained on them can not be typed, so you will need a genuine type for your result type.
Comments
Post a Comment