I am trying to write a rule that compares 4 properties and adds a warning result to all 4 properties when some condition exists.
In the ctor I am adding all properties to the InputProperties and adding the non-primary properties to the AffectedProperties like so:
: base(lnameProperty)
{
if (InputProperties == null)
{
InputProperties = new List<IPropertyInfo>();
}
InputProperties.Add(lnameProperty);//primary property
InputProperties.Add(fnameProperty);
InputProperties.Add(ssnProperty);
InputProperties.Add(bdateProperty);
AffectedProperties.Add(fnameProperty);
AffectedProperties.Add(ssnProperty);
AffectedProperties.Add(bdateProperty);
}
In the Execute function when the condition exists, I'm interating thru the InputProperties and calling context.AddWarningResult() for each property
int property, properties = context.Rule.InputProperties.Count;
for (property = 0; property < properties; property++)
{
context.AddWarningResult(context.Rule.InputProperties[property], "Test warning");
System.Diagnostics.Debug.WriteLine("Warning attached to " + context.Rule.InputProperties[property].Name);
}
It is only attaching the broken rule to the last property.
How do I get the broken rule to show up on all properties?
I'm beginning to think this is a CSLA bug.
I would appreciate any comments.
Copyright (c) Marimer LLC