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 - here's what I'd like to do:
(I'm using the Single Table model, and I'm happy for all my 'Animals' to be in the same table.) But using separate Discriminators seems not to work - you have to have the same Discriminator through the chain of inheritance? What would you recommend as a workaround? Because I need to be able to simply query for all Fish, or all Mammals, or more specifically for Dogs and Cats. (I'm not really creating some animal kingdom taxonomy, it's just illustrative. Lightspeed 4.0.) |
|
|
Can you elaborate on what is not working? I have set up a model here as you have described above and it appears to be working fine in that I can insert new entities and the correct discriminators are set at each level and then loading back the full set of Animals, Mammals or Fish correctly loads the derived types for each entity based on the two discriminators.
|
|
|
Sure, here are the steps:
Update the Db. The Table 'Animals' is created with columns Id, AnimalType, MammalType. That works okay. In code, create and save a 'Dog'. Now, what I would expect is that I have a row in my db table for my newly created Dog instance with AnimalType 1 (meaning a Mammal), and MammalType of 2 (meaning a Dog) - but the AnimalType is zero. (I also get a warning that Dog and Mammals are part of the same inheritance hierarchy, but have different discriminators.) I'm not sure what or where I'm going wrong. Thanks. |
|
|
Thanks for the extra detail, I can see what you mean now. I have added in a candidate fix for this issue which will be available for you in the next nightly build. Let us know if this covers the issue for you.
|
|
|
Yes that has done the trick. Thanks for the speedy response. I also had another query today which was quickly answered from the 'chat' thingy on your site - I must say I'm very impressed by the level of customer support Mindscape offers. Thanks again. |
|