inheritance question

Posts   
 
    
jspanocsi
User
Posts: 145
Joined: 04-Mar-2005
# Posted on: 19-Mar-2010 14:31:00   

I have a situation i haven't been able to find a built in solution for yet with inheritance.

So with a simple table structure of say Customer as a base table and then derived entities from it say UBCustomer, how do i get a record in UBCustomer if it already exists in customer.

What our app does, is you can have people that are customers, then when they apply for new services they may need to be BLCustomers, or UBCustomers etc. I already have an entity in CustomerTable but now in need one that matches it's id in BLCustomer or UBCustomer etc. Is there an easy way to do this? I know i can generate separate non inherited entities from BLCUstomer, UBCustomer etc and just use them to write a record and then go back to the inherited entities, but i was hoping that llbl gen had something built in for this. The table structure is FK to PK for inherited stuff like

Customer Table ID PK (auto incremented int) Name varchar

BLCustomer ID FK to Customer table ID Some Info

I tried passing the id from CustomerTable to a get of the UBCustomer, but on save it always makes new records in both tables instead of using the id i hand it and not writing a new customertable record.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 19-Mar-2010 19:29:51   

Not possible. From the inheritance concept, if you create a BLCustomer, it should create a Customer, as a BLCustomer is a Customer, and a new BLCustomer is a new Customer. If not, it would be possible you have many customer types with the same base which is incorrect.

If you need to promote Customer to many subtypes, maybe inheritance is not what you need. Anyway, you could workaround this the way you mentioned (creating a non-inherited entity in LLBLGen designer).

David Elizondo | LLBLGen Support Team
jspanocsi
User
Posts: 145
Joined: 04-Mar-2005
# Posted on: 19-Mar-2010 19:35:32   

thanks, yeah i figured it would be impossible. it's a weird situation where the base comes before the sub type and not all sub types exist. thanks for the info.