I'm hoping someone can shove me in the right direction here: How can I support validation of a property that is of a custom object type?
I'm trying to setup a library of generic csla objects, that can be used inside bigger csla objects for my work environment. For instance, I've created a flexible Address object (something in my work environment that is always handled differently from app to app). I'm hoping to use this object as a property in other larger csla objects.
I had no problems creating the smaller generic object. But when it comes to using it in these larger objects I run into the issue of being able to support the validation of this property (the generic smaller object).
Can anyone give me advice on this? Anything would be greatly appreciated.
I will suggest to use custom validation methods for such properties. In these methods u can simply check IsValid property of the object and in case of failure return the BrokenRulesCollection.
private
bool ValidateObject(object target, RuleArgs e){
if (target.IsValid){
return true;
}
else
{
e.Description =
target.BrokenRuleCollection.ToString(); return false;}
}
Thanks. I had actually discovered this exact approach in projectTracker recently. thought I didn't think of returning target.BrokenRuleCollection.ToString().
Copyright (c) Marimer LLC