multiple DataPortal_Update - with different parameters

multiple DataPortal_Update - with different parameters

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


Curelom posted on Friday, July 29, 2011

I'm trying to save with a business list.  If a concurrency error occurs, I want to prompt the user if they want to write over the changed values.  (I know, but that's what the users want.)  I've built the list with CSLA Extension code generator, so I can't modify the original DataPortal_Update.  I've created another DataPortal_Update as below.  My question is how do I call this method?  It doesn't seem to be the same way you would with a DataPortal_Fetch with diff parameters.

        protected override void DataPortal_Update(bool overrideConcurrency) {
            using (var ctx = Csla.Data.ObjectContextManager<FullyLoadedCostLibrary.Data.FLCEntities>.GetManager(FLCModel.FLCEntitiesDatabase.Name)) {
                Child_Update(overrideConcurrency);
            }
        }

JonnyBee replied on Friday, July 29, 2011

You're right, the DataPortal_Update method does NOT accept any parameters.

What comes to mind is to use a command object to do the"overridden" save with the list as a property on that command object.

Make the list a property on the CommandObject and call DataPortal_Update(bool) on the list from DataPortal_Execute on the command object.

 

 

Curelom replied on Monday, August 08, 2011

This solution should work for now.  Is this something that would be worthy of adding to the wish list?  I have no idea how difficult it would be to add and this is the first time I've come across a situation where I needed to do this after using CSLA for a number of years.

JonnyBee replied on Monday, August 08, 2011

Hi,

Rocky may correct me - but IMO this is an edge case.

Save is an instance method and you would normally have the option of adding properties to the BO that can be used to test for various conditions in the save method. 

RockfordLhotka replied on Monday, August 08, 2011

The idea of passing metadata along with a data portal call doesn't fit with the philosophy of the data portal. The idea is to reflect your requirements in the object model, and the data portal just flows the object model between the client and server - allowing the object model to do what it needs to do on either end of the network connection.

The ApplicationContext dictionaries are a compromise to allow out-of-band metadata to flow along with the model, but that's as far as I ever plan to go.

Copyright (c) Marimer LLC