Determine Discriminator Field at runtime

Posts   
 
    
Posts: 98
Joined: 09-Feb-2005
# Posted on: 07-Jul-2006 21:13:52   

Is there a way to determine which field is a discriminator field for an entity at runtime? I'm trying to populate data via reflection, and am having trouble figuring out how to tell my code to NOT specify a value for the discriminator, since the value is assigned automatically by the type that was instantiated.

Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 08-Jul-2006 10:45:17   

Call the entity's GetInheritanceInfo() method. it's a method that's hidden from intellisense but it's there, see the reference manual for details. That method will give you an IInheritanceInfo object, which contains the discriminator field index.

Frans Bouma | Lead developer LLBLGen Pro