Compartir a través de


Source Schema for the Validation Application Block

This topic lists the elements and attributes used to configure the Validation Application Block. The configuration file has the following section-handler declaration:

<configSections>
   <section name="validation"
            type="Microsoft.Practices.EnterpriseLibrary.Validation.Configuration.ValidationSettings,
                 Microsoft.Practices.EnterpriseLibrary.Validation" />
</configSections>

The section-handler declaration contains the name of the configuration settings section and the name of the section-handler class that processes configuration data in that section. The name of the configuration settings section is validation. The name of the section-handler class is Microsoft.Practices.EnterpriseLibrary.Validation.Configuration.ValidationSettings.

validation Element

This element specifies the configuration of a Validation Application Block. This element is required. The following table lists the attributes for the validation element.

Attribute

Description

configProtectionProvider

This attribute is the name of the provider that encrypts and decrypts the configuration file. Possible values are RsaProtectedConfigurationProvider and DataProtectionConfigurationProvider.

The validation element can contain one or more type child elements, and can contain an EncryptedData element if the content is encrypted.

EncryptedData Element

The EncryptedData element is a child of the validation element. The following table lists the attributes for the EncryptedData element.

Attribute

Description

xmlns

The namespace declaration. For more information, see the W3C XML Encryption Syntax and Processing recommendation.

Note

The EncryptedData element appears only within files that are encrypted.

type Element

This element is a child of the validation element. It defines a type that will be validated. The following table lists the attributes for the type element.

Attribute

Description

assemblyName

The name of the assembly that contains the type to be validated.

defaultRuleset

The name of the default rule set.

name

The name of the type to be validated.

The type element can contain one or more ruleset child elements

Note

The type element and its content appear only within files that are NOT encrypted.

ruleset Element

This element is a child of the type element. It contains the details of all the validators for this type. The following table lists the attributes for the ruleset element.

Attribute

Description

name

The name of the rule set

The ruleset element can contain one or more of the following elements:

  • A fields element that lists the validated fields for a specified object type
  • A methods element that lists the validated method for a specified object type
  • A properties element that lists the validated properties for a specified object type
  • One or more validator elements that define the validators applied to this type

fields Element

This element is a child of the ruleset element. It contains one or more field elements.

field Element

This element is a child of the fields element. It defines a field that will be validated. The following table lists the attributes for the field element.

Attribute

Description

name

The name of the field.

The field element can contain one or more validator elements.

methods Element

This element is a child of the ruleset element. It contains one or more method elements.

method Element

This element is a child of the methods element. It defines a method that will be validated. The following table lists the attributes for the method element.

Attribute

Description

name

The name of the method.

The method element can contain one or more validator elements.

properties Element

This element is a child of the ruleset element. It contains one or more property elements.

property Element

This element is a child of the properties element. It defines a property that will be validated. The following table lists the attributes for the property element.

Attribute

Description

name

The name of the property.

The property element can contain one or more validator elements.

validator Element

The validator element is a child of the ruleset, field, method, and property elements. If part of a composite validator, it can be the child of another validator element. This element specifies a validator that validates the type, field, method, or property. All validators have a name attribute that specifies the name of the validator, a type attribute that defines the type of the validator, and other attributes that are specific to each validator. For more information on the properties for each type of validator, see Using the Validation Block Validators.