How to access the discriminator Column ?

Did it exists a way to access the discriminator column Value and to change it ?

Hello Pierre, there is no such a way to do that, currently.

Thank you for your quick reply

My problem is to transform an instance of type TProspect to a instance of type TClient (TClient is a descendant of Tprospect in a 'singletable').
Did i need to create a new instance of type TClient, copy the data and destroy the instance of Type TProspect, or have you a better idea ?


Yes, you have to manually copy the values. That's the "correct" way of dealing with objects, you just can't transform an object of a class into another one. You also might have properties that are incompatible (one class might have properties that do not exist in the other class and vice-versa).

So it's not a safe operation. Of course, if in your specific case it's safe, as you said, you can just copy the properties or do a low-level SQL UPDATE in the discriminator field. But that is a hack anyway.

Thank you very much for your response !


For the moment i have used the hack !