Querying the existance of related tables

Posts   
 
    
JMitchell avatar
JMitchell
User
Posts: 128
Joined: 01-Sep-2006
# Posted on: 25-Sep-2010 12:35:01   

I've got tables (FlightItinerary and FerryItinerary) that extend another table (ItinerarySector).

How can I tell if either table has been created without requiring that table to be added?

If I check the values of IsNew and IsDirty, saving fails as it's trying to save all the tables.

I have got round it with a travel type flag but I would be interested to know what I should have done

Thanks

James

(Using VB.NET, LLBLGen Pro 2.6 Self Servicing.)

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 26-Sep-2010 13:46:55   

Hi James,

How can I tell if either table has been created without requiring that table to be added?

I not quite understand the question, sorry. You mean you have three tables, two of them are related 1:1 to ItinerarySector, right? Then you want to know if an entity is Flight or Ferry?

Are you using entity inheritance setup in your LLBLGen project? For more info read Polymorphic Fetches

David Elizondo | LLBLGen Support Team
JMitchell avatar
JMitchell
User
Posts: 128
Joined: 01-Sep-2006
# Posted on: 27-Sep-2010 10:04:02   

That's sounds right. I don't know if I'm using entity inheritance. Is it a default thing based on the database setup or is it a manual setting?

Basically, I want to know how to determine if an entity with a 1:1 relationship to the current entity has been instantiated without instantiating it.

It seems that what I'm doing at the moment is instantiating it, as when I do a recursive save, it is trying to save the related entity that hadn't previously been instantiated.

JMitchell avatar
JMitchell
User
Posts: 128
Joined: 01-Sep-2006
# Posted on: 27-Sep-2010 13:19:40   

I've found a better way to get round the problem - I've set LazyLoadingWithoutResultReturnsNew to false as discussed in this thead