ValidationConstraintTObject Class |
Namespace: Aloe.SystemFrameworks.Domain.Validation
public abstract class ValidationConstraint<TObject> : Constraint<TObject> where TObject : EditableDomainObject
The ValidationConstraintTObject type exposes the following members.
Name | Description | |
---|---|---|
![]() | ValidationConstraintTObject |
Initializes a new instance of the ValidationConstraintTObject class.
|
Name | Description | |
---|---|---|
![]() | Attribute |
The data attribute for which the constraint is defined or null if the constraint is not for specific attribute.
(Inherited from ConstraintTObject.) |
![]() | Code |
Gets the unique rule code.
(Inherited from BusinessRule.) |
![]() | DefaultExecutionPriority |
Gets the default execution priority of the rule.
It is used when priority is not specified when registering the rule for events.
(Inherited from ConstraintTObject.) |
![]() | ExecuteForDeletedObject |
Gets a value indicating whether to execute the rule for deleted object. The default is false.
Inheritors can override it.
(Inherited from BusinessRule.) |
![]() | GetAttribute |
Gets the function that returns the attribute of the constraint.
The attribute is specified for constraints, which constrain a specific attribute.
(Inherited from ConstraintTObject.) |
![]() | GetMessage |
Gets the message getter function.
The function is called to create and format a message in case of constraint violation.
|
![]() | IsActivated |
Gets a value indicating whether this constraint has already been activated.
(Inherited from ConstraintTObject.) |
![]() | LocalizedName |
Gets the localized name of the rule.
(Inherited from BusinessRule.) |
![]() | Name |
Gets the rule name.
(Inherited from BusinessRule.) |
Name | Description | |
---|---|---|
![]() | Activate |
Activates the constraint.
(Inherited from ConstraintTObject.) |
![]() | Execute |
Executes the business rule on the specified object.
(Inherited from BusinessRule.) |
![]() | ExecuteCore |
Executes the business rule on the specified object.
(Overrides BusinessRuleExecuteCore(DomainObject, BusinessEvent).) |
![]() | IsValid |
Validates the object and returns true if the object is valid according to the constraint.
|
![]() | OnRegistration |
Called upon registration of the business rule in a repository.
(Inherited from BusinessRule.) |
![]() | ToString |
Returns a String that represents this instance.
(Inherited from BusinessRule.) |
IsValid/GetMessage is a constraint implementation pattern adequate for simple constraints.
With this pattern, the checking and the message generation are separated, which simplifies creating and maintaining simple constraints.
For complex constraints, which build the validation message during the check, it is advisable to inherit from different class. For example, multi-line constraints, which can return errors for multiple lines are better served with classes like ScriptedConstraintTObject.