Hi,
I'd like to suggest adding a new delegate for validation rules that returns the result inside the eventargs, instead of returning a boolean value. So instead of this code:
Private Shared Function CheckABRule(Of T As MyBO)(ByVal target As T, ByVal e As Validation.RuleArgs) As Boolean If target.PropertyA > target.PropertyB ThenWe would have this little more compact code:
Private Shared Sub CheckABRule(Of T As MyBO)(ByVal target As T, ByVal e As Validation.ResultRuleArgs)
e.Description = "A must be lower than B"
e.Result = Not (target.PropertyA > target.PropertyB)
End Sub
What do you think?
Regards
Private Shared Sub CheckABRule(Of T As MyBO)(ByVal target As T, ByVal e As Validation.ResultRuleArgs) As Boolean
e.Description = "A must be lower than B"
Return Not (target.PropertyA > target.PropertyB)
End Sub
Copyright (c) Marimer LLC