Hi,
I am using a business object as search criteria within the client. I want at least one property to be supplied by the user before they can perform a search. I have a search button (IsEnabled) that is bound to the IsValid property of the business object.
Is there a good example of how to require that at least one property is supplied in order for it to be valid?
Thanks!
Which version of CSLA?
4.0
If all you care about is having IsValid be false, I'd create an object-level business rule (a rule not attached to a specfic property) that checks to see if at least one property has a value. Then in OnPropertyChanged call BusinessRules.CheckObjectRules to run this rule every time a property changes.
protected override void OnPropertyChanged(string name)
{
base.OnPropertyChanged(name);
BusinessRules.CheckObjectRules();
}
Copyright (c) Marimer LLC