BO.Save and BO.SaveByForm


Author
Message
Chan
Chan
Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

May I know when should I use BO.Save() and when should I use BO.SaveByForm()? I found that BO.SaveByForm() will return more info such as exception which should be more prefered. However, in most sample, BO.Save() is used.



Please advice.



Thank you
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
It really depends on what are trying to accomplish.  The BO.Save() is ultimately called by the SaveByForm or Save() method of a form.  The only difference is that when a SaveByForm (Save() of the form) is called, it will attempt to save all BOs and respect the IncludeInForm properties as well as gather up all of the exceptions and broken rules for all BOs versus just each individual BO.
Chan
Chan
Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

Thank you for reply.

When I compare source code for both methods (Bo.Save() vs Bo.SaveByForm()) they are almost the same, except Bo.SaveByForm() return value contains more info.



In my case, I am writing save function for my base Gridview and WebPage. I feel that SaveByForm() is more suitable as more info usually always better.



By then, I am curious on in what situation I should use Bo.Save() instead of Bo.SaveByForm()?



Thank you
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Honestly, in this case, I would probably just call the save on the BO.  The information is irrelevant if it is not pertinent to the BO at hand being saved.  Each individual BO will provide all of the same information as the SaveByForm.  The reason that the SaveByForm appears to have more detail is because it includes information for all BOs versus just the BO in question.

Calling an individual BO in this case would probably be the route that I would take.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search