Just started using business rules(and I can see the great power they have) and need some clarification on best practices.
1) Views on when to use a read-only property or business rule to derive a readonly (non-db) property e.g. Fullname.
2) I have some complicated calculations e.g. calculation charges on a timesheet.
Should my rules be quite specific or more general?
For instance TotalTravelTime is made up of TotalTravelTimeOutward and TotalTravelTimeReturning.
TotalTravelTimeOutward is the result of TimeStartToVenue-TimeArriveToVenue and TotalTravelTimeReturning s the result of TimeStartBackFromVenue-TimeEndBackFromVenue. (there are other rules/calc to calculate charges etc).
So should I have 1 business rule to calculate TotalTravelTime - if I change any one of the four properties that affect the grand total
or
So should I have 2 business rules to calculate TotalTravelTime - depending on whether outward or return journey.
[I would also have to calculate TotalTravelTimeCharge and other calcs] - so several business rules which are fired when specific properties are changed or one big one that recalculates everything when any one of the properties change.
3) My TotalTravelTimeOutward is updated via a business rule and not stored in database (as above) - however when I load my page/screen the value is not populated - do I need to call business rule explicitly to get this value?
I'd like to clarify the requirements for the RuleEngine:
My preferred solution:
The CascadeOnDirtyProperties is new in Csla 4.5.10 and must be set in DataPortal_Fetch/DataPortal_Create.
IE: It is an instance flag, <bo>.BusinessRules.CascadeOnDirtyProperties, default is false.
Thank for prompt reply - I will digest and get back
Copyright (c) Marimer LLC