Table of Contents

Class ModelValidationNode

Namespace
System.Web.Http.Validation
Assembly
System.Web.Http.dll

Provides a container for model validation information.

public sealed class ModelValidationNode
Inheritance
ModelValidationNode
Inherited Members

Constructors

ModelValidationNode(ModelMetadata, string)

Initializes a new instance of the ModelValidationNode class, using the model metadata and state key.

public ModelValidationNode(ModelMetadata modelMetadata, string modelStateKey)

Parameters

modelMetadata ModelMetadata

The model metadata.

modelStateKey string

The model state key.

ModelValidationNode(ModelMetadata, string, IEnumerable<ModelValidationNode>)

Initializes a new instance of the ModelValidationNode class, using the model metadata, the model state key, and child model-validation nodes.

public ModelValidationNode(ModelMetadata modelMetadata, string modelStateKey, IEnumerable<ModelValidationNode> childNodes)

Parameters

modelMetadata ModelMetadata

The model metadata.

modelStateKey string

The model state key.

childNodes IEnumerable<ModelValidationNode>

The model child nodes.

Properties

ChildNodes

Gets or sets the child nodes.

public ICollection<ModelValidationNode> ChildNodes { get; }

Property Value

ICollection<ModelValidationNode>

The child nodes.

ModelMetadata

Gets or sets the model metadata.

public ModelMetadata ModelMetadata { get; }

Property Value

ModelMetadata

The model metadata.

ModelStateKey

Gets or sets the model state key.

public string ModelStateKey { get; }

Property Value

string

The model state key.

SuppressValidation

Gets or sets a value that indicates whether validation should be suppressed.

public bool SuppressValidation { get; set; }

Property Value

bool

true if validation should be suppressed; otherwise, false.

ValidateAllProperties

Gets or sets a value that indicates whether all properties of the model should be validated.

public bool ValidateAllProperties { get; set; }

Property Value

bool

true if all properties of the model should be validated, or false if validation should be skipped.

Methods

CombineWith(ModelValidationNode)

Combines the current ModelValidationNode instance with a specified ModelValidationNode instance.

public void CombineWith(ModelValidationNode otherNode)

Parameters

otherNode ModelValidationNode

The model validation node to combine with the current instance.

Validate(HttpActionContext)

Validates the model using the specified execution context.

public void Validate(HttpActionContext actionContext)

Parameters

actionContext HttpActionContext

The action context.

Validate(HttpActionContext, ModelValidationNode)

Validates the model using the specified execution context and parent node.

public void Validate(HttpActionContext actionContext, ModelValidationNode parentNode)

Parameters

actionContext HttpActionContext

The action context.

parentNode ModelValidationNode

The parent node.

Events

Validated

Occurs when the model has been validated.

public event EventHandler<ModelValidatedEventArgs> Validated

Event Type

EventHandler<ModelValidatedEventArgs>

Validating

Occurs when the model is being validated.

public event EventHandler<ModelValidatingEventArgs> Validating

Event Type

EventHandler<ModelValidatingEventArgs>