StrataFrame Forum

Work with BO in ReadOnly Mode ?

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

By Rainer Kempf, RK - 3/17/2009

Hello



I use some BO's only for displaying Data. These BO's are Bound to a DevExpress.Grid



Grid is in readonly mode.



When i navigate through the Grid and then Close form BO ask for save data.



Is there as way to tell BO it should ignore all. i mean something like a READ_Only flag.



thanks



Rainer
By Philipp Guntermann - 3/17/2009

Hi Rainer,

try setting the "AutoShowSaveChangesMessage"-Property on the Form to false.

this should prevent it to show the save changes confirmation message.

By Rainer Kempf, RK - 3/17/2009

Hi Phillip



Works , Super



Thank you



Rainer
By Edhy Rijo - 3/18/2009

Hi Reiner,

Since you want to treat the data in the BO as ReadOnly, I believe that setting the property "AutoShowSaveChangesMessage" will simply not show the save confirmation message, but internally it may be saving the data back, I am not sure this is what is happening, but if that is the case you may end up with unwanted saved data.

Check out the BO properties SetDirtyOnEdit and ManageUIReadOnlyState and play with them, since I believe that setting these property to False may prevent the BO to become Dirty and will not trigger any saving.

By Charles R Hankey - 3/18/2009

There is also an option in BO mapper to set a column 'read only' though I don't know its implications. Anybody?
By Greg McGuffey - 3/18/2009

I believe the BO mapper just serializes the field as a readonly property (no setter). The field would be bindable, so you could bind it to a control in order to view the data, but if you attempted to set the value, you'd get an error.
By Charles R Hankey - 3/18/2009

So SF will exclude the field prop from the Update statement on a save ?



Anybody have a real-world example of why you would use that and is it effectively the same as adding the field to the ExcludefromUpdate collection in the BO?


By Greg McGuffey - 3/18/2009

One likely reason would be that the field will be filled by a trigger and never any other way. You could also use this with a calculated field in SQL.



The reason to use this instead of the Exclude properties would be to strongly enforce the readonly nature. You don't have to remember to set the exclude properties, nobody can override those values, etc.