Class ValidationRule
- Namespace
- TimeCockpit.Data.DataModel
- Assembly
- TimeCockpit.Data.dll
Represents a ValidationRule which can be applied to a ModelEntityBase
public class ValidationRule : ModelElement, IDynamicMetaObjectProvider, INotifyPropertyChanged, IDataErrorInfo
- Inheritance
-
ObjectValidationRule
- Implements
-
IDynamicMetaObjectProviderINotifyPropertyChangedIDataErrorInfo
- Inherited Members
-
Object.ToString()Object.Equals(Object)Object.Equals(Object, Object)Object.ReferenceEquals(Object, Object)Object.GetHashCode()Object.GetType()Object.MemberwiseClone()
Constructors
ValidationRule()
Initializes a new instance of the ValidationRule class
public ValidationRule()
ValidationRule(IEnumerable<KeyValuePair<Object, Object>>)
Initializes a new instance of the ValidationRule class.
public ValidationRule(IEnumerable<KeyValuePair<object, object>> properties)
Parameters
propertiesIEnumerable<KeyValuePair<Object, Object>>Collection of properties.
ValidationRule(ValidationRule)
Initializes a new instance of the ValidationRule class.
public ValidationRule(ValidationRule element)
Parameters
elementValidationRuleThe element.
Properties
Condition
Gets or sets the condition of of the ValidationRule
public string Condition { get; set; }
Property Value
- String
Function
Gets the CLR function for the calculated property
public Func<EntityObject, object> Function { get; }
Property Value
- Func<EntityObject, Object>
Remarks
The function needs the EntityObject on which it should operate as the first parameter.
IsDisabled
Gets or sets a value indicating whether the validation rule is disalbed or not.
public bool IsDisabled { get; set; }
Property Value
- Boolean
trueif this instance is disalbed; otherwise,false.
Message
Gets or sets the message that should be issued if the validation fails
public string Message { get; set; }
Property Value
- String
Perpetrator
Gets or sets the name of the propery that is responsible for the failing validation
public string Perpetrator { get; set; }
Property Value
- String
Methods
Accept(ModelElementVisitor)
accepts a visitor. Dispatches the visit handler method for a ValidationRule
public override void Accept(ModelElementVisitor visitor)
Parameters
visitorModelElementVisitorthe visitor to dispatch to.
GetParticipatingMembers()
Gets the participating members of the of validation condition.
public IEnumerable<string> GetParticipatingMembers()
Returns
- IEnumerable<String>
Returns the enumeration of participating members.
Validate(ref IList<PropertyValidationMessage>, Boolean)
Validates a ModelElement according to certain rules.
protected override void Validate(ref IList<PropertyValidationMessage> messages, bool validateRecursively)
Parameters
messagesIList<PropertyValidationMessage>An list of strings that stores that picks up the validation errors of a model element.
validateRecursivelyBooleanIndicates wheter to validate only the current model element or all its children (recursively) as well.
Remarks
The rules the ModelElement is validated against are dependent on the type of ModelElement that is validated. This method can be overridden to provide custom validation behavior for subclasses of ModelElement
When Validate(ref IList<PropertyValidationMessage>, Boolean) is called on a modelelement, the Validate(ref IList<PropertyValidationMessage>, Boolean) method of all children attatched to the modelelemnt are validated recursivly.