Notifying the UI of Save and Deletions - Overriding Save in BusinessBase

Notifying the UI of Save and Deletions - Overriding Save in BusinessBase

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


Tom_W posted on Friday, November 08, 2013

In our editable root classes we have some static code that allows UI components to register a delegate method that will be invoked when that editable root is saved.  The purpose is to let forms displaying summary lists know when they should refresh themselves. (This is a winforms app by the way).

That seems to work well, and because the delegate list is static it seems to avoid issues with memory leaks and accidentally keeping business objects alive.

To trigger the delegates I have overridden BusinessBase.Save, but to do that I had to change the declaration from 'public T Save()' to 'public virtual T Save()' in the framework code.

In the happy new world of NuGet I'd like to avoid having changes to the CSLA framework, so is there something else I can override or handle that would give me the same functionality?  

I also have a feeling Save may not be virtual for a good reason?

 

JonnyBee replied on Saturday, November 09, 2013

Hi Tom,

I assume that you are using CSLA 4.5 and the method to override is actually SaveAsync.

This method is called for both sync and async Save.

Tom_W replied on Monday, November 11, 2013

Perfect, thanks Jonny

Copyright (c) Marimer LLC