Hey Bob (or Tim),
I now have my code in both HookPreSaveEntity and HookPreSave, yet when I call the Parent BO's SaveEntity() this code does not get called. Where else do I need to call my code?
UPDATE: I needed the code in the HookPreSaveEntityList since this was a child business object>There is a HookPreSaveEntity method as well which I guess gets called before SaveEntity. I would create another method to do what you want in a preSave and then call that method from both HookPreSave and HookPreSaveEntity.
>
>
>>Thanks again.
>>
>>I did find a difference between SaveEntity() and SaveDataSet(). I have some code in an BO's HookPreSave which does not get called when I call SaveEntity(). Should it, or should I put my HookPreSave code somewhere else?
>>
>>>Frank,
>>>
>>>That seems about right. Make sure you also add to the child business objects the following in the HookConstructor method:
>>>
>>>
>>>protected override void HookConstructor()
>>> {
>>> this.AutoSaveOnParentSaved = true;
>>> this.AutoCancelOnParentCancel = true;
>>> this.AutoDeleteOnParentDeleted = true;
>>> this.AutoEmptyOnParentAdded = true;
>>> this.ForeignParentKeyField = "insert FK here";
>>> }
>>>
>>>
>>>The only time the above code is used is when you use the RegisterChildBizObj method.
>>>
>>>Don't know the difference between SaveEntity and SaveDataSet as I always use SaveEntity.
>>>
>>>Bob
>>>
>>>>Thanks Bob,
>>>>
>>>>so my code should look like this?
>>>>
>>>>
protected override void DefineParticipatingObjects()
>>>> {
>>>> this.oPolicyHeader = (PolicyHeader)this.RegisterBizObj(new PolicyHeader());
>>>> this.oPolicy = (Policy)this.RegisterBizObj(new Policy());
>>>> this.oPolicyLoan = (PolicyLoan)this.RegisterBizObj(new PolicyLoan());
>>>> this.oReceipt = (Receipt)this.RegisterBizObj(new Receipt());
>>>> this.oReceiptDetail = (ReceiptDetail)this.RegisterBizObj(new ReceiptDetail());
>>>>
>>>> this.oPolicyHeader.RegisterChildBizObj(this.oPolicy);
>>>> this.oPolicyHeader.RegisterChildBizObj(this.oPolicyLoan);
>>>> this.oPolicyHeader.RegisterChildBizObj(this.oReceipt);
>>>> this.oReceipt.RegisterChildBizObj(this.oReceiptDetail);
>>>> }
>>>>
>>>>Then when I want to save I just do:
>>>>
>>>>
mmSaveDataResult result = oPolicyHeader.SaveEntity();
>>>>
>>>>How do I decide if I want to call SaveDataSet or SaveEntity or something else?