Click or drag to resize

ValidationConstraintTObject Class

Abstract base class for all validation rules, based on IsValid/GetMessage implementation pattern.
Inheritance Hierarchy
SystemObject
  Aloe.SystemFrameworks.Domain.BusinessLogicBusinessRule
    Aloe.SystemFrameworks.Domain.ValidationConstraintTObject
      Aloe.SystemFrameworks.Domain.ValidationValidationConstraintTObject
        More...

Namespace:  Aloe.SystemFrameworks.Domain.Validation
Assembly:  Aloe.SystemFrameworks.Domain (in Aloe.SystemFrameworks.Domain.dll) Version: 20.1.3.5
Syntax
public abstract class ValidationConstraint<TObject> : Constraint<TObject>
where TObject : EditableDomainObject

Type Parameters

TObject
The type of object to which the validation rule applies

The ValidationConstraintTObject type exposes the following members.

Constructors
  NameDescription
Public methodValidationConstraintTObject
Initializes a new instance of the ValidationConstraintTObject class.
Top
Properties
  NameDescription
Public propertyAttribute
The data attribute for which the constraint is defined or null if the constraint is not for specific attribute.
(Inherited from ConstraintTObject.)
Public propertyCode
Gets the unique rule code.
(Inherited from BusinessRule.)
Public propertyDefaultExecutionPriority
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.)
Public propertyExecuteForDeletedObject
Gets a value indicating whether to execute the rule for deleted object. The default is false. Inheritors can override it.
(Inherited from BusinessRule.)
Public propertyGetAttribute
Gets the function that returns the attribute of the constraint. The attribute is specified for constraints, which constrain a specific attribute.
(Inherited from ConstraintTObject.)
Public propertyGetMessage
Gets the message getter function. The function is called to create and format a message in case of constraint violation.
Public propertyIsActivated
Gets a value indicating whether this constraint has already been activated.
(Inherited from ConstraintTObject.)
Public propertyLocalizedName
Gets the localized name of the rule.
(Inherited from BusinessRule.)
Public propertyName
Gets the rule name.
(Inherited from BusinessRule.)
Top
Methods
  NameDescription
Public methodActivate
Activates the constraint.
(Inherited from ConstraintTObject.)
Public methodExecute
Executes the business rule on the specified object.
(Inherited from BusinessRule.)
Public methodExecuteCore
Executes the business rule on the specified object.
(Overrides BusinessRuleExecuteCore(DomainObject, BusinessEvent).)
Public methodIsValid
Validates the object and returns true if the object is valid according to the constraint.
Public methodOnRegistration
Called upon registration of the business rule in a repository.
(Inherited from BusinessRule.)
Public methodToString
Returns a String that represents this instance.
(Inherited from BusinessRule.)
Top
Remarks

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.

See Also
Inheritance Hierarchy
SystemObject
  Aloe.SystemFrameworks.Domain.BusinessLogicBusinessRule
    Aloe.SystemFrameworks.Domain.ValidationConstraintTObject
      Aloe.SystemFrameworks.Domain.ValidationValidationConstraintTObject
        Aloe.EnterpriseOne.Model.Core.SpecialTypesCodeAttributeConstraintTObject
        Aloe.EnterpriseOne.Model.Core.SpecialTypesIdentifierAttributeConstraintTObject
        Aloe.EnterpriseOne.Model.Core.SpecialTypesStrictCodeAttributeConstraintTObject
        Aloe.SystemFrameworks.Domain.ValidationAutoNumberConstraintTMaster, TDetail
        Aloe.SystemFrameworks.Domain.ValidationCheckConstraintTObject
        Aloe.SystemFrameworks.Domain.ValidationDetailConstraintTMaster, TDetail
        Aloe.SystemFrameworks.Domain.ValidationMasterConstraintTMaster, TDetail
        Aloe.SystemFrameworks.Domain.ValidationRequiredAttributeConstraintTObject