Monday 15 September 2014

c# - How to break apart the Linq expression inside an Any clause -


I'm trying to create a modular link query (for an otdata source).

This is a simplified version of my query:

  // Any section that I call the modular Func & lt; Encounter, bool & gt; Order Any = x = & gt; ("Order 00") with X.OrderName.Starts; // Question using any clause var results = entities.Customers.Where (customer = & gt; cust.Orders.Any (orderAnyClause)); // One method to select it just works fine. IQueryable & LT; SearchSelectionResult & gt; Selected result = selection result (result); // It throws the exception shown below the var list = selectedResults.ToList ();   

All of these are well compiled, but when I run it, any section causes this exception:

Type 'object to cast hopeless at. Linux.Expressions 'System.Linq.Expressions.LambdaExpression' to type 'system encryption'.

I know that this is my clause because if I embed a block in the statement, it all works well. / P>

Why am I getting this error? And how can I break this statement and not get the error?


Update: Use of an expression

I tried using an expression like this: < Pre> expression & lt; Funk & lt; Encounter, bool & gt; & Gt; Order Any = x = & gt; ("Order 00") with X.OrderName.Starts;

And I get the following error message when compiling:

  Example logic: System.Data.Services.Client.DataServiceCollection & lt; ODataComponetizedQueriesTest.MyEntities .Order & gt; For 'System.Linq.IQueryable & lt; ODataComponetizedQueriesTest.MyEntities.Order & gt; '    

You can try defining the order, either:

  expressions & lt; Funk & lt; Encounter, bull & gt; & Gt; Order Any = x = & gt; ("Order 00") with X.OrderName.Starts;   

I did not test it, but in the way the query works (and based on error), it will not be able to do anything with it unless it expresses it Is not found in the form of

No comments:

Post a Comment