StrataFrame Forum

IncludeInFormSave

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

By Larry Caylor - 10/21/2006

I have three BOs on a SF maintenance form. One of the BOs is used to populate a listview and while it will be modified during the life of the form, it will never need to be saved. The form’s IncludeInFormSaveType property is set to DeterminedByBusinessObject and the BO that should not be saved IncludeInFormSave property is set to False. When I select Save on the form the two BOs that I want saved are but the form doesn’t automatically close. When I attempt to close it I get a “Do you want to save changes message?” The form's AutoShowSaveChangesMessage property = True.

 

Looking at the source code for BaseForm.OnFormClosing I see that it cycles through the BOs on the form and sets SaveNeeded if the BO is dirty. It seems to me that it should also check to see if the BO's IncludeInFormSave = False and if so, don’t mark it as SaveNeeded regardless of whether it is dirty or not.

 

Although I can work around the issue by using the form’s before save event and undoing the changes on the BO that shouldn’t be saved, it seems that the form shouldn’t be marking it as SaveNeeded in the first place.

 

-Larry

 

By Trent L. Taylor - 10/22/2006

Well, actually this is by design and more than likely will not be changed.  The IncludeInFormSave property is for just that...saving via the form Save() methods.  This does not mean that the BO will not need to be saved in another context and that is why the BO still updates itself and notices that it needs to be saved.  All you need to do to make the BO think there are no changes is the following:

MyBO.CurrentDataTable.RejectChanges()

or

MyBO.CurrentDataTable.AcceptChanges()

This will clear any changes and will tell the DataTable that there is nothing that needs to go back to the server. It will also give you a False value when you reference the IsDirty property.