using System;
namespace Csla.Validation
{
///
/// Object providing extra information to methods that
/// implement business rules.
///
public class RuleArgs
{
private string _propertyName;
private string _description;
private RuleSeverity _severity = RuleSeverity.Error;
private bool _stopProcessing;
///
/// The name of the property to be validated.
///
public string PropertyName
{
get { return _propertyName; }
}
///
/// Set by the rule handler method to describe the broken
/// rule.
///
/// A human-readable description of
/// the broken rule.
///
/// Setting this property only has an effect if
/// the rule method returns .
///
public string Description
{
get { return _description; }
set { _description = value; }
}
///
/// Gets or sets the severity of the broken rule.
///
/// The severity of the broken rule.
///
/// Setting this property only has an effect if
/// the rule method returns .
///
public RuleSeverity Severity
{
get { return _severity; }
set { _severity = value; }
}
///
/// Gets or sets a value indicating whether this
/// broken rule should stop the processing of subsequent
/// rules for this property.
///
/// if no further
/// rules should be process for this property.
///
/// Setting this property only has an effect if
/// the rule method returns .
///
public bool StopProcessing
{
get { return _stopProcessing; }
set { _stopProcessing = value; }
}
///
/// Creates an instance of RuleArgs.
///
/// The name of the property to be validated.
public RuleArgs(string propertyName)
{
_propertyName = propertyName;
}
///
/// Return a string representation of the object.
///
public override string ToString()
{
return _propertyName;
}
}
}