I've come across some unexpected behavior when using bo.Save(true) (i.e. BO-level saving, not form-level saving)
If I have a simple saving method as follows:
void SaveProject() {
BusinessLayer.TransactionBegin("", IsolationLevel.ReadCommitted);
SaveUndoResult result = bo.Save(true);
if (result == SaveUndoResult.Success) {
BusinessLayer.TransactionCommit("");
}
else {
BusinessLayer.TransactionRollback("");
}
}
Let's suppose I call SaveProject(), but the bo fails its CheckRules. Therefore, the save operation fails and the transaction is rolled-back, as expected. However, the internal value of bo._IsSavedOnTransaction is set to true by bo.Save function, even though the rules checked fail. (Note: the call to BusinessLayer.TransactionRollback does not reset the value bo._IsSavedOnTransaction to false.)
Now, if I fix the cause of the rule failure and call ProjectSave() a second time, nothing happens
Why? Because the value bo._IsSavedOnTransaction is true from the first call, and bo.IsDirty (called in the bo.Save() routine) returns false. Therefore, no save is attempted.
I don't know if this is a bug or a feature. At least, it's unexpected behavior.