Back to Devexpress

ModelValidationContextsNodeGenerator Class

expressappframework-devexpress-dot-expressapp-dot-validation-cfe36403.md

latest3.5 KB
Original Source

ModelValidationContextsNodeGenerator Class

A Nodes Generator that generates the content of the IModelValidationContexts node.

Namespace : DevExpress.ExpressApp.Validation

Assembly : DevExpress.ExpressApp.Validation.v25.2.dll

NuGet Package : DevExpress.ExpressApp.Validation

Declaration

csharp
public class ModelValidationContextsNodeGenerator :
    ModelNodesGeneratorBase
vb
Public Class ModelValidationContextsNodeGenerator
    Inherits ModelNodesGeneratorBase

Remarks

This class is a ModelNodesGeneratorBase descendant, that generates child nodes of the Validation | Contexts node. It uses IRuleBaseProperties.TargetContextIDs values from the Validation | Rules | Rule nodes to collect Validation Contexts, and adds an IModelValidationContext node for each Context.

To customize the content of the Contexts node, implement a Generator Updater for this Nodes Generator by inheriting the ModelNodesGeneratorUpdater<T> class in the following manner:

csharp
public class Updater : ModelNodesGeneratorUpdater<ModelValidationContextsNodeGenerator> {
    public override void UpdateNode(ModelNode node) {
        // Cast the 'node' parameter to IModelValidationContexts
        // to access the Contexts node.
    }
}

The Generator Updater above should be registered within the overridden ModuleBase.AddGeneratorUpdaters method.

For a complete list of available Nodes Generators, refer to the Built-in Nodes Generators topic.

Inheritance

Object ModelNodesGeneratorBase ModelValidationContextsNodeGenerator

See Also

ModelValidationContextsNodeGenerator Members

Read and Set Values for Built-in Application Model Nodes in Code

Validation Rules

Declare Validation Rules

DevExpress.ExpressApp.Validation Namespace