Question about InputProperties and AffectedProperties in Business Rule #3361
-
I am going through old code and I noticed something about the way we have called the Add method of InputProperties and AffectedProperties inside our rules constructor. In some cases, we have supplied the parameter name to InputProperties.Add like InputProperties.Add(employeeid) //employeeid is a parameter of our business rule and in other cases InputProperties.Add(EmployeeID) //EmployeeID is the property defined in our Business rule class Is there any difference between the two? Kind regards |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
If you are creating a rule that is designed for reuse across any type of business class, then you need to pass properties as parameters to the constructor. If you are creating a private rule for one specific business class, then you can hard-code the properties into the rule. Personally I try to nest these rules inside the business class to make it clear that they are "private". You can also mark them |
Beta Was this translation helpful? Give feedback.
If you are creating a rule that is designed for reuse across any type of business class, then you need to pass properties as parameters to the constructor.
If you are creating a private rule for one specific business class, then you can hard-code the properties into the rule. Personally I try to nest these rules inside the business class to make it clear that they are "private". You can also mark them
private
, but that makes it harder to write unit tests for the rule.