The situation is as follows:
- I have a BO 'Transaction' which owns multiple 'LineItems'.
- There are BO rules for both the LineItems and the Transaction. In some cases, the Transaction BO rules are updated following changes in the LineItems, for example if there are LineItems added, removed or changed.
- There is a form for the Transaction which also shows the LineItem as a grid, which is editable.
- After editing certain LineItems in the grid that result in the Transaction being updated (because of the business rules), I always get an error message when subsequently trying to save the Transaction.
So how do I ensure that this can form can be saved, when there are changes as a result of the BO rules?
I read somewhere on this forum about the possibility to create a temporary BO, copy all data from the 'real' BO to the temp BO, then edit the temp BO, then copy everything back to the original BO upon save. That may be a solution, but it would be a lot of work because I would not only have to copy all direct attributes but also all of the references (in this case the LineItems) from the one to other and back again, so it is hardly an viable option. I am hoping there is a simpler solution. Presumably this situation where a BO is changed by its own business rules is rather common, so I can't quite understand why it must result in this error.