IdeaBlade.Validation Assembly > IdeaBlade.Validation Namespace : Verifier Class |
'Declaration
<DebuggerDisplayAttribute(Value="{GetType()}; {ErrorMessageInfo}; {ApplicableType}", Name="", Type="", Target=, TargetTypeName="")> Public MustInherit Class Verifier Implements System.IComparable(Of Verifier)
'Usage
Dim instance As Verifier
[DebuggerDisplay(Value="{GetType()}; {ErrorMessageInfo}; {ApplicableType}", Name="", Type="", Target=, TargetTypeName="")] public abstract class Verifier : System.IComparable<Verifier>
All verifiers will be instances of a some subclass of this abstract Verifier class. The IdeaBlade Verification library consists of several predefined Verifier subclasses as well as several higher level abstract classes that allow developers to construct their own verifiers.
The primary responsibility of every verifier is to verify the state of some business object and return the result of this verification in the form of a VerifierResult. At its simplest a VerifierResult is a result code indicating the success or failure of a verification as well as a more detailed description if necessary.
Each verifier has an ApplicableType property that represents the type of object that the verifier was designed to verify. Verifiers with an ApplicableType of any .NET base type are assumed to be applicable to all subclasses of that base type. The VerifierEngine will insure that any verifiers registered against a base class will automatically be applied to any verification of instances of any of its subclasses.
Every verifier has a ErrorMessageInfo property that is intended to produce a human readable string that describes the verifier and will be used by the VerifierEngine to produce a default verification status message on completion of verifier execution. Custom status messages are fully supported as well.
A verifier cannot be executed until it has been added to a VerifierEngine. An individual verifier instance can be attached to only one VerifierEngine at a time. Verifiers are by default executed in the order that they were added to the VerifierEngine, however it is possible to change this order via the SortValue property on each verifier.
During the execution of any verifier the VerifierEngine first calls the IsApplicable method. If the IsApplicable method returns a VerifierApplicability with a VerifierApplicabilityCode.No or VerifierApplicabilityCode.InsufficientData, then the VerifierEngine will immediately construct an “errant” VerifierResult for this verifier using the information in the VerifierApplicability result and continue on to the next appropriate verifier. Only if a VerifierApplicability.Yes is returned will the VerifierEngine attempt to actually call the Verify method.
The rationale for the IsApplicable method call is that the execution cost of some verifiers may be so high as to make it good practice to avoid calling them unless a set of preconditions can be met first. This is, however, a relatively rare occurrence and therefore the base IsApplicable implementation in the abstract Verifier class simply returns VerifierApplicability.Yes. In general, most subclassed verifiers will only need to implement the Verify method and rely on the base class implementation of IsApplicable.
System.Object
IdeaBlade.Validation.Verifier
IdeaBlade.Validation.PropertyValueVerifier
IdeaBlade.Validation.Verifier<T>
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2