Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> Deleting entities from collections
 

Pages: 1
LLBLGen Pro Runtime Framework
Deleting entities from collections
Page:1/1 

  Print all messages in this thread  
Poster Message
obzekt
User



Location:

Joined on:
29-Apr-2004 18:18:59
Posted:
49 posts
# Posted on: 18-Aug-2004 17:08:48.  
Say an entity Customer has an Orders collection and there is a method UpdateCustomer(CustomerEntity ce) that saves the changes of both the parent entity and its collection in one call.

Adding/Editing orders in the collection are easy to be reflected in the DB using adapter's SaveEntityCollection, but what do you suggest for deleting orders (w/o adding a different method)?

Is there a way for the client to 'flag' them as removal candidates and have the method walk through the collection, delete those flagged ones and save the rest?
  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37869 posts
# Posted on: 18-Aug-2004 17:57:53.  
Not at the moment. (A unitofwork object is in the works at the moment as part of the runtime upgrades). What you could do is remove the entity from the collection in the grid (as it is removed from the grid as well) and add it to a collection solely for deletion purposes, then simply use DeleteEntityCollection() to delete the entities in 1 go. To make this happen in the same transaction as the saves, start a transaction first by calling StartTransaction, then call the persistence functions like save and delete.

Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
obzekt
User



Location:

Joined on:
29-Apr-2004 18:18:59
Posted:
49 posts
# Posted on: 19-Aug-2004 12:53:50.  
I see. In other words, I have to be explicit in the method declaration about this second collection, e.g. UpdateCustomer(CustomerEntity ce, EntityCollection deletedOrders), where ce.Orders will contain the remaining order entities that are either new or edited ones.

Thanks Otis.
  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37869 posts
# Posted on: 20-Aug-2004 11:45:47.  
obzekt wrote:
I see. In other words, I have to be explicit in the method declaration about this second collection, e.g. UpdateCustomer(CustomerEntity ce, EntityCollection deletedOrders), where ce.Orders will contain the remaining order entities that are either new or edited ones.

Yes. Regular Smiley


Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.