CSLA 8 - Setting InputProperties
in the ctor of a BusinessRule is throwing an error
#3900
-
After upgrading to CSLA 8 - I'm getting a weird error on some broken rule classes in their CTOR.
Here is an example that throws the error: public class NoLeadingSpacesRule : BusinessRule
{
/// <summary>
/// Initializes a new instance of the <see cref="NoLeadingSpacesRule"/> class.
/// </summary>
/// <param name="primaryProperty">
/// The string property to test
/// </param>
public NoLeadingSpacesRule(PropertyInfo<string> primaryProperty)
: base(primaryProperty)
{
InputProperties = new List<IPropertyInfo>();
}
protected override void Execute(IRuleContext context)
{
string message = string.Format("{0} must not have leading space(s)", PrimaryProperty.FriendlyName);
string value = (string)ReadProperty(context.Target, PrimaryProperty);
if (!string.IsNullOrWhiteSpace(value) && value.StartsWith(" "))
{
context.AddErrorResult(message);
}
}
} Two really weird things:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
That sounds really weird. We are at 8.1.0 and are setting the |
Beta Was this translation helpful? Give feedback.
That sounds really weird. We are at 8.1.0 and are setting the
InputProperties
, too without any problems.Are you sure you have the right assemblies are loaded? For v9 I removed the set on that list: #3880