| The help documentation has a flow chart that shows the exact save sequence. I just pulled this image from the help documentation, but for more information read [ Business Layer -> Common Business Object Tasks -> Saving Data ] in the help and this should clear some things up. 
When a Save is called, the business rules are checked on each row within the DataTable. As the business object checks each row, it raises the CheckRulesOnCurrentRow event (where the business logic resides). If there is even one broken rule on any row, no data will be saved back to the server until all of the rules have been corrected. If the AutoNavigateToFirstBrokenRow property on the business object is set to true, the business object will automatically position itself on the first broken record. You can access the broken rules one of two ways, first you can use the BrokenRules property: BrokenRules Example Dim loRule As MicroFour.StrataFrame.Business.BrokenRule For Each loRule In Customers.BrokenRules.ToArray() '-- Show the rule Console.WriteLine(loRule.Description) Next The other method is to capture the BusinessRulesChecked event on a business object or a form and use the event arguments passed to that event. BusinessRulesCheckedEvent Example Private Sub Customers_BusinessRulesChecked(ByVal e As StrataFrame.Business.BusinessRulesCheckedEventArgs) Handles Customers.BusinessRulesChecked '-- Establish Locals Dim loBO As MicroFour.StrataFrame.Business.BusinessLayer Dim loRule As MicroFour.StrataFrame.Business.BrokenRule
'-- When captured on a form, there may be more than one business object with broken rules ' this is how to cycle through all of the business objects with broken rules For Each loBO In e.AllBrokenRules.Keys For Each loRule In loBO.BrokenRules.ToArray() '-- Show the broken rule Console.WriteLine(loRule.Description) Next Next End Sub You can also determine how many broken rules there are on the current row, all other rows, and an accumulation of all rows using the same event arguments in the BusinessRulesChecked event: Broken Rules Counters Private Sub Customers_BusinessRulesChecked(ByVal e As StrataFrame.Business.BusinessRulesCheckedEventArgs) Handles Customers.BusinessRulesChecked Console.WriteLine("Broken rules on this row: {0}", e.CountOfBrokenRulesCurrentRow) Console.WriteLine("Broken rules on other rows: {0}", e.CountOfBrokenRulesAdditionalRows) Console.WriteLine("Broken rules on all rows: {0}", e.CountOfBrokenRulesTotal)
End Sub You can also force the save and ignore all broken rules. When this is done, the data will be saved back to the server regardless of the broken rules. Ignoring Broken Rules Private Sub Customers_BusinessRulesChecked(ByVal e As StrataFrame.Business.BusinessRulesCheckedEventArgs) Handles Customers.BusinessRulesChecked '-- Ignore the broken rules and force the save e.IgnoreRulesAndForceSave = True End Sub |