Dela via


ModelStateDictionaryExtensions Class

Definition

Extensions methods for ModelStateDictionary.

public ref class ModelStateDictionaryExtensions abstract sealed
public static class ModelStateDictionaryExtensions
type ModelStateDictionaryExtensions = class
Public Module ModelStateDictionaryExtensions
Inheritance
ModelStateDictionaryExtensions

Methods

AddModelError<TModel>(ModelStateDictionary, Expression<Func<TModel,Object>>, Exception, ModelMetadata)

Adds the specified exception to the Errors instance that is associated with the specified expression. If the maximum number of allowed errors has already been recorded, ensures that a TooManyModelErrorsException exception is recorded instead.

AddModelError<TModel>(ModelStateDictionary, Expression<Func<TModel,Object>>, String)

Adds the specified errorMessage to the Errors instance that is associated with the specified expression. If the maximum number of allowed errors has already been recorded, ensures that a TooManyModelErrorsException exception is recorded instead.

Remove<TModel>(ModelStateDictionary, Expression<Func<TModel,Object>>)

Removes the specified expression from the ModelStateDictionary.

RemoveAll<TModel>(ModelStateDictionary, Expression<Func<TModel,Object>>)

Removes all the entries for the specified expression from the ModelStateDictionary.

TryAddModelException<TModel>(ModelStateDictionary, Expression<Func<TModel,Object>>, Exception)

Adds the specified exception to the Errors instance that is associated with the specified expression. If the maximum number of allowed errors has already been recorded, ensures that a TooManyModelErrorsException exception is recorded instead.

Applies to