Inheritance and TargetPerEntity/TargetPerEntityHierachy

Posts   
 
    
bdeline
User
Posts: 13
Joined: 13-Jul-2006
# Posted on: 18-Mar-2007 20:01:42   

I couldn't find this in the forums so my apologies if its been asked before. I have a situation where it would be most useful to have an overlap on these two inheritance types. I have a table called Lead which is my supertype and I also have a table called LeadDebt and LeadMortgage as sub-types of this supertype. I initially set this up as a TargetPerEntity iheritance model in the LLBLGen designer. However, I am starting to see where the TargetPerEntityHierachy might be useul in its use of a discriminator field stored in the Lead table. The big positive would be in terms of reporting out of the database using ad-hoc queries, I could just query the Lead table and my discriminator field would indicate in my query results what type of Lead a particular record was versus having to do some sql joining mumbo-jumbo on my sub-type tables.

To sum up, is it possible to use a discriminator field in conjunction with the TargetPerEntity inheritance model? Or is there some slick way to have a discriminator field be saved in the Lead table with a specific value when I save a LeadDebt entity? Thanks. Brett

Posts: 1268
Joined: 10-Mar-2006
# Posted on: 19-Mar-2007 07:30:35   

To sum up, is it possible to use a discriminator field in conjunction with the TargetPerEntity inheritance model? Or is there some slick way to have a discriminator field be saved in the Lead table with a specific value when I save a LeadDebt entity? Thanks. Brett

In your entity class for the TargetPerEntity, you could override the InsertEntity method, and put your discriminator value in. It would then be there for reports.