delete removed fk related objects

Posts   
 
    
shennig
User
Posts: 48
Joined: 14-Nov-2006
# Posted on: 18-Aug-2010 14:55:22   

hi,

i'm using Gen Pro Version 3.0 Final (with adapter) for a ms sql server 2008 database in a client server scenario (.net 3.5 sp1), in wich entities are loaded on the server an passed with web services (wcf) to the client. only the server has a connection to the database.

how can i delete implicitly related entities from 1:n relations?

an example: there is a 1:n relation between customer (1) and orders (n). customer a has orders 1, 2 and 3. on the client order 2 is removed from the collection in the customer. the customer object is passed from client to server and the customer entity is saved recursively with:

adapter.SaveEntity(customer, true, true);

but the removed order 2 is not deleted in database. if i add an order 4 to the collection in customer it is saved.

so, can i delete an related entity via removing it from the collection of the base-entity? or need i to load the collection from database to calculate the removed entities and save them explicit?

best regards,

shennig

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 18-Aug-2010 16:42:37   
shennig
User
Posts: 48
Joined: 14-Nov-2006
# Posted on: 19-Aug-2010 09:27:00   

thanks for this hint! i've searched with the wrong search words.