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 Guys, I know that you are all working hard to get v3.0 out :) Would it be possible in the future to mybe include model validations when using inheritance (STI)? E.g: Employee (BaseEntity), PermEmp (Inherits from Employee. On Type = "P" ) TempEmp (Inherits from Employee. On Type = "T" ). The validation that if possible I would like is to ensure that the "Discriminator Name" that's part of the inheritance connector does exist in on the (BaseEntity).
Regards, Johan J v Rensburg |
|
|
LightSpeed doesn't actually require the discriminator attribute to exist on the base entity type. That is, the discriminator name can be something that isn't a property of the base type, provided there's a column in the database for it. This is often desirable because it prevents the error of taking a TempEmp entity and setting its Type to 'P'. (Does such an entity represent a permanent or temporary employee? Do we believe the CLR type, or the Type discriminator attribute? One of them must be wrong!) In fact, it's arguably better to keep the discriminator "virtual" unless you need to be able to supply values for base class instances (e.g. you only want to create a derived class for certain specific values). And we don't really want to raise a validation warning for something that is actually often a good design! That said, the designer doesn't provide great support for "virtual discriminators" -- we don't consider them during database synchronisation. And we realise that for many users a non-matching discriminator *is* more likely to be a typing error. So we'll certainly ponder whether we can provide some help with this without punishing people who do use the virtual discriminator pattern. Thanks for the suggestion! |
|