I noticed my rules not getting run automatically when I used the DataPortal.ChildXYZ(obj param). But when I call it with no params ex. DataPortal.ChildXYZ() then CheckRules does get run.
Is that by design? Am I supposed to do something in my void Child_Create(object param) methods?
MarkAsChild is getting called...so I would have thought CheckRules would too?
Thanks
Sean
Perhaps I am supposed to call base.ChildXYZ first thing or last thing in my version of void Child_Create?
OK I noticed this works to call the CheckRules
private void Child_Create(object parent)
{
ParentId = parent.Id;
base.Child_Create();
}
I didn't know I was supposed to call base.Child_Create() or base.Child_Fetch() to get that functionality. I figured it was the dataportal actually doing the CheckRules call.
So why is CheckRules not called on ChildDataPortal_XYZ methods automatically just like DataPortal_XYZ methods?
It is all handled in the same way:
protected virtual void Child_Create() { BusinessRules.CheckRules(); }
protected virtual void DataPortal_Create() { BusinessRules.CheckRules(); }
and the DataPortal does NEVER call BusinessRules.CheckRules.
So - when you create other overloads on these methods it is your reponsibility to either call the base.CYZ_Create or call BusinessRules.CheckRules(). CSLA Framework / DataPortal does not enforce BusinessRules.CheckRules when you create other overloads.
Copyright (c) Marimer LLC