Unit of Work AddForDelete

Posts   
 
    
psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 02-Nov-2009 18:47:03   

Came across the same problem as described in this thread:

http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=15388&HighLight=1

The workaround was straightforward, so no problem there.

I'm curious why the AddForDelete method requires an entity to be fetched from the database, where the adapter's entity delete does not? I would think the two methods would function identically. What is the reasoning behind the entities in the UOW needing to be fetched from the database before deletion?

Thanks,

Phil

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 03-Nov-2009 05:49:32   

I think it have to do with the possible correlation between entities to add and entities to delete. If you add an entity to delete and it also has added in entities to insert, the UOW has to make a decision on whether save it, delete it, etc. In this case, the logic is clear: is you add a new entity to the toDelete collection it means that you want to remove it to the insert collection (in case you added it earlier to the toInsert collection). So I think it is more a convention thing to make the process clear and unambiguous. The workaround should work though.

David Elizondo | LLBLGen Support Team