Removing object from EntitySet In Relational Database

71 Views Asked by At

i have 2 table "Flight" and "Legs" legs has a field named "Flight_ID" and is nullable Flight has a Field same as "Flight_ID" which is primary key.

i made 2 entityset for them

dim flt as new EntitySet(Of Flight)
dim Lg new EntitySet(Of LEGS)

removing an item from Flights, doesnt Set null the "Flight_ID" Field Of Leg table. How to connect two entitysets together , then quering one ,gets related records from other entityset not actual database.

Actually im new with linq, i have a same old scenario, i want to load database from server to an in memory,(i mean some diffrent related table) and query them like quering server, then finally save all changes into database, or discard the chenges.(by changes i mean, newly added records, changed records, and deleted records). For this i used Entitysets and at startup i fill entitysets by records that i need:

Flt.addrange(From x in dbase.flight where x.start>start and x.end<end select x)
Leg.addrange(From x in dbase.leg where x.start>start and x.end<end select x)

But when i query one of this and want to get related object, its retrieved from server. I think I'm doing it wrong, may be there is another way around for this scenario. Thanks in advance

0

There are 0 best solutions below