Unit of Work pattern - Deleter example missing

Unit of Work pattern - Deleter example missing

Old forum URL: forums.lhotka.net/forums/t/10331.aspx

tiago posted on Sunday, May 01, 2011

Hi Rocky,

On PTracker we have unit of work pattern examples of Creator and Getter. Those are ReadOnly collections. This is a way to make sure a given set of objects is present at a given time and it's most important in asynchronous scenarios. Otherwise I risk to have an object to edit but not having all the NameValueList needed to populate the combo boxes for that object. (BTW, CslaGenFork has a UnitOfWork object type with the implementation of Getter ready and Creator well advanced).

On Using Csla 4 ebooks samples we also an Updater. This is a CommandBase object that transactionally updates two or more objects. It's a "all or nothing" strategy: if it doesn't succeed to update all of them, it doesn't update anything at all. 

What is missing is a Deleter example. If it doesn't succeed to delete all of them, it doesn't delete anything at all.

RockfordLhotka replied on Sunday, May 01, 2011

Delete is no different from update right? Or am I missing something?

Just in the DataPortal_Execute you'd make calls to delete each root object instead of to update each root object - using immediate or deferred deletion, depending on the model supported by each root.

Copyright (c) Marimer LLC