Or Composite Validator
Retired Content |
---|
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
The latest Enterprise Library information can be found at the Enterprise Library site. |
Class Name: OrCompositeValidator
Attribute Name: None
Configuration tool name: Or Composite Validator
Description
This validator creates a composite validator. Validation requires that at least one of the validators that make up the composite validator be true. For example, you can use the Or Composite Validator to require that the Not Null Validator OR the Date Time Range Validator be true.
Properties
The following table lists the Or Composite Validator properties.
Or Composite Validator Properties
Property |
Description |
---|---|
Tag |
This property is a user-supplied string. Typically, it is used to sort or categorize validation results that are in a log. |
MessageTemplate |
This property is a user-supplied string. Typically, it describes the validation result and is intended for a log. |
MessageTemplateResourceName |
If you do not want to use the MessageTemplate property to specify a message, you can use another template by specifying it with the MessageTemplateResourceName value. If you include both a MessageTemplate value and a MessageTemplateResourceName value, the MessageTemplate value takes precedence. |
MessageTemplateResourceTypeName |
If you specify a MessageTemplateResourceName value then you must specify a MessageTemplateResourceTypeName value, which is the type of the template you want to use. |
Examples
The following examples show how to use the validators with attributes and with code.
Attributes
This example shows the construction of an OrCompositeValidator object using attributes. The validator combines a NotNullValidator and a StringLengthValidator.
public class Product
{
[ValidatorComposition(CompositionType.Or)]
[NotNullValidator]
[StringLengthValidator(10)]
public string ProductCode
{
get
{
return _productCode;
}
}
// ...
}
'Usage
Public Class Product
<ValidatorComposition(CompositionType.Or)> _
<NotNullValidator()> _
<StringLengthValidator(10)> _
ReadOnly Property ProductCode(ByVal _productCode As String)
Get
Return _productCode
End Get
End Property
' ...
End Class
Retired Content |
---|
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
The latest Enterprise Library information can be found at the Enterprise Library site. |