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 have three classes, ToEmailMessageAddress, FromEmailMessageAddress and BccEmailMessageAddress which all inherit from EmailMessageAddress and set the appropriate "Type" column to discriminate each instance. This is saving perfectly - exactly as expected; however when hydrating seems to cause issues. On the appropriate EmailMessage it has three relationships: [ReverseAssociation("Message"), EagerLoad] The EmailMessageAddress, of course, has a MessageId and Message properties respectively which link back to each address. Now upon hydration I get the following SQL statement generated three times: SELECT As you can see, it is not disinguishing types anymore, and thus gives an error: System.ArgumentException: The value "ToEmailMessageAddress [Id=1265b58f-0e93-46b0-99b8-19030a40ac67, EntityState=Default]" is not of type "TiviT.Base.Framework.Model.System.Email.BccEmailMessageAddress" and cannot be used in this generic collection. Is this something that I am doing, or should the framework be distinguishing the types and adding a Type=2 or whatever to the query (which would fix the issue)? One workaround I can think of is to have a core collection of EmailMessageAddress 's and simply use linq to get the appropriate types for each collection, however thought I should check if I was doing something incorrect first. Thanks for your help. Paul |
|
|
We think this is a bug where the discriminator is not being applied in eager-load scenarios. We are looking into a fix now. In the meantime, you should find that removing EagerLoad gives you the correct, discriminated collections. We appreciate that this will impact performance but you will be able to put EagerLoad back once we have a fix and it will save you changing your application code. |
|
|
Hi Ivan, Thanks for your quick answer; you are right - removing EagerLoad works correctly. Thanks for your help. Regards, Paul |
|
|
Hi Paul, Just to let you know I have committed a candidate fix for this which will be in the 4 July nightly build. We believe it will work for your scenario though we are still doing a bit of internal review to assess whether it will also address more complex scenarios. Please give it a try when it's available (should be up around about 1430 GMT) and let us know if it fails to solve the problem or if you run into any other issues. Thanks! |
|
|
Hi Ivan, Is their a nightly build for the professional version of Lightspeed? I couldn't find it under the "My Account" section. I do own the license Paul |
|
|
Just a quick message to let you know that the nightly build does solve this issue. Sorry for the delay in testing and thanks for your help! |
|