I have a complex BO that contains a number of additional BOs. For simplicity, my complex BO is called MainBO which instantiates _BO1, _BO2 and _BO3 (these are private BOs contained within MainBO). _BO1 has columns called test1, test2, and test3. _BO2 has columns called test4, test5 and test6. _BO3 has columns called test7 and test8. I have exposed these columns through Custom Field Properties and each is bound to a form. Each is populated through a scalar query executed during the Custom Field's Property Get procedure. The form only has MainBO dropped on it. When running the form, as I navigate through records everything works perfectly. When I click the edit toolstrip button, all of these fields become editable. If I edit fields that were originally part of MainBO, the values save properly. If I edit the fields exposed through MainBO such as test1, the Property Set procedures work perfectly. The problem is that clicking the save button causes Property Gets to fire, so the new values for test1 - test8 get reset to their original values before they can be saved. I am trying to save these secondary BOs in the BeforeSave event for MainBO, but by the time that code executes, the values for test1 - test8 have already been reset.
Is putting the code to retrieve the appropriate values for the secondary BOs in Property Get procedures a bad idea? If so, where should that code be placed? Better yet, is this the approach I should be using?
I'm not sure if it makes a difference but I'm using the StrataFrame Maintenance form so the initial save to MainBO is called through the MaintenanceFormToolStrip.
To complicate this further, what if the records I want to retrieve from _BO2 and _BO3 are dependent on values from _BO1? Basically, MainBO and _BO1 can be thought of as a logical "record" although the values are spread across two tables (and I cannot redesign the db). The only keys defined in the database are primary keys for each table represented by the BOs. There are no foreign keys defined in the database-- all of the fk relationships are managed by existing software code. I need to be able to save values first to _BO1 and then to MainBO, and each of these may contain lookup values that correspond to columns in _BO2 and _BO3.
This is my first complex BO in the real world, so once I am able to get past this hurdle I will test the Add/Delete functionality and if everything works I'll be able to use this as a model for other complex BOs.
Thanks,
Michael Cobb