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 attempting to perform an outer join between two tables but I am receiving the dreaded "Specified method not supported." Here's a trivial example: Three entities: Customer, Order I'm trying to retrieve a list of ALL Customers with any associated Orders (if any) for one particular order category. My LINQ query looks something like: IQueryable<CustomerWithOrder> custOrders = from cust in UOW.Customers The "Specified Method Not Supported" seems to be related to the order == null condition. If I remove this, the query executes, however it is effectively performing an inner join. Any chance you could amend LS to support this scenario? Thanks, Greg |
|
|
Hi Greg, Yes, the issue relates to the reference to the entity directly rather than a field of the entity (e.g. Id). I have added in a check for this which will translate that into the identity field of the entity. This will be included in the next nightly build (20100501) and above.
Jeremy |
|
|
Hi Jeremy, Thanks, I see that the SQL is now generated as expected. However, Lightspeed seems to have difficulty when the resultset contains Null values for those entities on the right side of the outer join. [LightSpeedException: Unable to materialize field [Id] on type [DomainModel.Entities.Order]: field is type 'System.Guid' but database returned type 'System.DBNull'. Check your table has an Id column and that your mappings are correct. See inner exception for details.] Any suggestions? Thanks, Greg
|
|
|
Hi Greg, Could you post the SQL being generated by that query - or a small repro sample of the behavior? The exception infers that the entity is being loaded in a situation where the values are null, which is not a valid scenario for LightSpeed to deal with - rather you should be getting a null entity back. But the query you have posted doesnt appear to need to do that.
Jeremy
|
|
|
Hi JB, I've attached a small repro that exhibits the behaviour. The SQL statement is a fairly typical looking left outer join: SELECT Obviously, with an outer join, it is possible for one side of the join to be null. In this case, LS is trying to hydrate an Order entity using an Order.Id that is null. |
|
|
Hi Greg, Thanks for the repro for this issue. I have implemented a candidate fix for this and it will be included in the next nightly build (20100505). The problem was with a check around when an entity should be loaded or not depending on the current value of the Identity field which has already been pre-loaded from the reader. I have added a check for DBNull to cater for the Guid behavior and this resolves the scenario in your repro sample. Let us know if there are any further issues :)
Jeremy |
|