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
|
I have a warning indicating that 2 classes are part of the same inheritance hierarchy but have different discriminators and I can't figure out why this warning shows up. I am using STI. My base class has a Kind property of type String. The Discriminator property of that class is set to Kind. My 2 subclasses have no property (at the moment). Each inheritance arrow is set with the following: Discriminator Name = Kind Discriminator Type = String Discriminator Value = "Image" for one class, and "Link" for the second one. Am I setting this incorrectly? Thanks, Gilles |
|
|
Same warning now in another part of my domain model: I have an Item which is a concrete class, and a Kit class which is a child class of Item. I set STI between them. I specified Kind for the Discriminator property of the Item class. The inheritance relationship is set the following way: Discriminator Name = Kind Discriminator Type = String Discriminator Value = Kit and I get the following warning: Warning 1 Kit and Item are part of the same inheritance hierarchy but have different discriminators So again, is this normal? Should I configure this inheritance differently? Thanks, Gilles |
|
|
That looks fine from what you've described. The only thing I can think of is if there is another base class involved somewhere, e.g. if Item is a derived class of something else. Is that a possibility? Could you post your model? |
|
|
Ah -- I think we have a bug where this warning incorrectly appears if your STI root class is derived from another class using concrete table inheritance. Is this what happens in your model? If so, you can ignore the warning for now and we will aim to get it fixed in the next nightly build. |
|
|
i have a lot of these warnings in my model - they're annoying (and the messaging is kind of misleading) but don't affect its working correctly - have had our model working in production no problems. it happens for me when i have this (using STI): EntityA : LightSpeed.Entity EntityB : EntityA EntityC : EntityB EntityD : EntityB where EntityA and EntityB are abstract.
So any time you have multiple abstract classes in an STI inheritance hierarchy you get this message. Not a problem - just ignore them.
|
|
|
Hmm, sounds like we should be allowing missing discriminators on abstract classes -- they can never be instantiated so they don't need discriminator values. You're just leaving the discriminator blank, right? If so, we can certainly try to fix that for you! |
|
|
yep, a fix for that would be great! currently i have discriminator values of "NA" for any abstract classes in the hierarchy - because LS won't let me leave them blank - throws an error. |
|
|
Okay, I've implemented a patch whereby it will no longer complain if an abstract class has no discriminator (i.e. Discriminator Name is left empty). However, if you supply a discriminator name anyway, the discriminator, including its value, will still be validated and emitted into the generated code. (Yes, I am somewhat paranoid about changing existing behaviour!) So to get rid of the warnings you will need to delete the Discriminator Name if you have one. As usual, the patch will be in the next nightly build. |
|
|
Yes, all my entities derive from EntityBase where I have put my audit fields (CreatedOn/By, UpdatedOn/By, DeletedOn/By). EntityBase is an abstract class, but does not have a discriminator. See attached image for extract of my model. Here is the exact warning message: Will your patch address this issue? Thanks, |
|
|
Yes, this does look like the issue we patched. Try the latest (29 Aug) nightly build -- I think that will make the warning go away. |
|