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 there, I would like to create a class that inherits directly from the Fact entity and implements some business logic around creating, updating and deleting records from the Fact table. I have read the blogs on this site concerning table inheritance, but since the descendent class will not add any further properties (table fields), it would seem that table inheritance does not apply ?? I intend to use a static method to retrieve the object, but am getting an error "Descendent type is not discriminated". Here is a code sample. public class MyBusinessObject : Fact The "Descendent type is not discriminated" exception is thrown on the first line of the static Load() method. Can someone please point me in the right direction? Thanks in advance, |
|
|
Hi Damien, You need to apply a DiscriminatorAttribute to the derived class specifying the discriminator property name and the value for that property which can uniquely identify instances of that class when being materialised. e.g. If you had a FactType property and all MyBusinessObjects were FactType = 1 then when declaring your DiscriminatorAttribute your property name would be FactType and the value would be 1
|
|
|
Hi Jeremy, Thanks again, |
|
|
You will need a column you can use to distinguish the derived entities, if you already have a way of doing this you can just wire up the DiscriminatorAttribute accordingly otherwise you will need to add a new column for this purpose.
|
|