Delete into a transaction

Posts   
 
    
Wally
User
Posts: 285
Joined: 29-Aug-2007
# Posted on: 27-Apr-2009 15:36:02   

I try to delete into a transaction and nothing seems to happen. Is anybody hjave an idea what I do wrong ???

I try 2 differents approaches:

1-


trans.Add(loc.EvenementLocLocRes);
foreach (EvenementLocLocResEntity existingLocLocRes in loc.EvenementLocLocRes)
{
    trans.Add(existingLocLocRes);
    existingLocLocRes.Delete();
}
trans.Commit();

2-


trans.Add(loc);
trans.Add(loc.EvenementLocLocRes);
loc.EvenementLocLocRes.DeleteMulti();
trans.Commit();

In either case, if I do a select in the database after the commit, I get the exact same count of EvenementLocLocRes for the loc object(entity). It looks like the delete never happen ????

Wally
User
Posts: 285
Joined: 29-Aug-2007
# Posted on: 27-Apr-2009 15:57:46   

I have part of my solution. In the documentation, it is written that DeleteMulti() without params do not delete in the persistent storage. I changed :

DeleteMulti() ==> DeleteMulti(null) and seems to work fine but...

Is anybody can tell me:

  • Why the same method with the same "name" does do 2 differents things ?

  • Why my first approach does not work also ? I don't understand ?

  • Why every objects (entity or collections) that we get from relations fields are not part of the same transaction as the calling object (when this latter one is already part of a transaction) ? I don't understand the logic behind that ? Is there any case where it could be usefull ?

Wally
User
Posts: 285
Joined: 29-Aug-2007
# Posted on: 27-Apr-2009 22:25:37   
Please put a hold on this... I need to make more verifications...
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 28-Apr-2009 05:57:47   

Ok. I will close this temporally. When you post it will be re-opened.

David Elizondo | LLBLGen Support Team