This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi guys! I wrote my own Linq extension to filter entities by some complex criteria. Here is the code of this extension:
And I'm going to use it in the following way:
Explanation: I'd like to specify in lambda the property holding Branch ID (it may differ from entity to entity) and then use this lambda in my extension to find only entities with concrete Branch IDs. But I got the error "This expression type is not supported in LightSpeed 4.0 " [note: I'm using LS 5.0 - it seems that you need to correct also the version in constant string of your exception's message] And here is the part of exception's stack trace:
Can you help me please in reaching my goal? The error is in the "where" predicate. I need to get somehow Branch ID property's value and check if it is in branches list. Please advice me how to do that? |
|
|
Try extracting the branchIdPropertySelector(x) call from the Lambda method and evaluating it to a local variable inside the BranchFilter method. Then use the local variable in place of that call within your lambda. Based on the code I expect thats the unsupported aspect of the expression.
|
|
|
Thank you Jeremy for your reply! But it seems that I can't extract branchIdPropertySelector(x) call from where clause because it should be executed for every entity inside where (to get Branch ID for every entity and decide if it is in the branches list). If I misunderstood you could you please show me the code example reaching this? |
|
|
This problem is still active. Could you advice something else? |
|
|
Sorry but Im afraid this is not going to work without bringing the bulk of the query client side by forcing enumeration as we cannot evaluate the in-loop method at the server.
|
|