StrataFrame Forum

UpdateUsingStoredProcedure on a subclassed BO

http://forum.strataframe.net/Topic25627.aspx

By Michel Levy - 1/27/2010

Hi,

In my project, all BO come from a BO library, in which they are all set with UpdateUsingStoredProcedure as True.

When I set UpdateUsingStoredProcedure as False on a BO on a form, this setting seems to be overridden by the setting of the BO in the BO library: saving by formSave raises an error (unable to find the update SP on the database).

I need to dynamically set it to False in the overriding function Save, before calling MyBase.Save

Is it anything I don't understand on subclassing in .Net?

By Trent L. Taylor - 1/30/2010

Well, it all depends on when you actually set the UpdateUsingStoredProcedure property to true. It sounds like it is a standard .NET serialization issue. For example, when you modify the actual BO itself and set this property to true, you could technically override it on the form, thus creating a serialized value in the form designer class. To prevent this from ever happening, you could do several things. The first would be to just force this value to be initialized or set in the BO class itself in code (i.e. the OnBeforeSave). This would ensure that this property is properly set prior to use.



I am unsure why your project is doing this, but I would start by looking at the BO instance on the form or where you have it dropped to see if the form designer is overriding this setting. Otherwise, you could force it as I mentioned above.