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, I'm trying to integrate LightSpeed with Breeze but for the purposes of this question, I think the main point is that I'm trying to pass an IQueryable/Expression to the LightSpeed LINQ provider and LightSpeed is throwing an exception which probably implies that it is unable to construct suitable SQL for the supplied query. Specifically, the problem occurs when a query containing multiple predicates is created. A single predicate works just fine but the invalid cast exception listed below occurs whenever we ask to filter the LightSpeed query by more than one criterion. I know that LightSpeed supports multiple criteria when it builds Expressions from LINQ statements so I don't understand why it fails when the expression is supplied in this alternative way. My experience with Expression trees is limited so I'd appreciate it if someone could help me understand whether this might be a LightSpeed limitation (and any suggested workarounds) or whether there is a concrete explanation or suggestion I can put to the Breeze team in order to ensure that their supplied IQueryable will work properly with LightSpeed. I'm finding it difficult to work out what the salient information is so I'm not sure if the call that triggers the exception matters or whether it is more related to the Expression contained within the IQueryable. The code looks something like this:
where queryResult is an IQueryable. This is the exception:
I've managed to get a pdb file and break into the debugger at that point to inspect the Expression contained within the IQueryable. This is the Expression.DebugView that causes the above exception:
NB: Items in the Wildscreen.Warehouse namespace are our LightSpeed Entities, those in Wildscreen.Warehouse.API.Model are (very similar) DTOs used by ASP.NET Web API and transferred to Breeze. With a single (successful) predicate, Expression.DebugView looks similar but with the following simpler Lambda2:
I'm using a nightly build from November 2013. Happy to upgrade if needed but since we're in the closing stages of a large project, I've avoided it until now because I haven't seen anything in the release notes to suggest there have been changes to expression handling, etc. Is there anything else I can supply that would help you understand the problem? Thanks, Chris |
|
|
This sounds like a translation issue in the LINQ provider, but it may be because what you want to translate cannot be translated and we are throwing a dumb exception. If you are able to send through a repro project I can work with here then I can confirm whats going on here and see if there is anything we can do to resolve this from our end.
|
|
|
I’ve sent an email to support with a repro solution. Through the process of building the solution, I think I’ve narrowed down the problem to only certain types of property. Multiple predicates appear to work fine as long as they do not contain enums, despite single predicates with enums working OK. Thanks, Chris |
|
|
Thanks Chris, Ill be having a look into this today so Ill post an update once Ive had a dig into what going on with this.
|
|
|
Hi Chris, Thanks again for the repro, just a quick update to let you know Ive tracked down how this is occurring and am currently testing a candidate fix for this so hope to have this available soon for you.
|
|
|
Hi Chris, We have merged in a fix for this today so this will be available in the next nightly build. Let me know if you continue to see any issues after you have had a chance to update.
|
|
|
We've upgraded to the 20140623 nightly and the fix has worked as expected. Thanks! |
|