ModelStateDictionary Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents the state of an attempt to bind values from an HTTP Request to an action method, which includes validation information.
public ref class ModelStateDictionary : System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<System::String ^, Microsoft::AspNetCore::Mvc::ModelBinding::ModelStateEntry ^>>, System::Collections::Generic::IReadOnlyCollection<System::Collections::Generic::KeyValuePair<System::String ^, Microsoft::AspNetCore::Mvc::ModelBinding::ModelStateEntry ^>>, System::Collections::Generic::IReadOnlyDictionary<System::String ^, Microsoft::AspNetCore::Mvc::ModelBinding::ModelStateEntry ^>
public class ModelStateDictionary : System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateEntry>>, System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<string,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateEntry>>, System.Collections.Generic.IReadOnlyDictionary<string,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateEntry>
type ModelStateDictionary = class
interface IReadOnlyDictionary<string, ModelStateEntry>
interface seq<KeyValuePair<string, ModelStateEntry>>
interface IEnumerable
interface IReadOnlyCollection<KeyValuePair<string, ModelStateEntry>>
type ModelStateDictionary = class
interface seq<KeyValuePair<string, ModelStateEntry>>
interface IEnumerable
interface IReadOnlyCollection<KeyValuePair<string, ModelStateEntry>>
interface IReadOnlyDictionary<string, ModelStateEntry>
Public Class ModelStateDictionary
Implements IEnumerable(Of KeyValuePair(Of String, ModelStateEntry)), IReadOnlyCollection(Of KeyValuePair(Of String, ModelStateEntry)), IReadOnlyDictionary(Of String, ModelStateEntry)
- Inheritance
-
ModelStateDictionary
- Implements
Constructors
ModelStateDictionary() |
Initializes a new instance of the ModelStateDictionary class. |
ModelStateDictionary(Int32) |
Initializes a new instance of the ModelStateDictionary class. |
ModelStateDictionary(ModelStateDictionary) |
Initializes a new instance of the ModelStateDictionary class by using values that are copied
from the specified |
Fields
DefaultMaxAllowedErrors |
The default value for MaxAllowedErrors of |
Properties
Count | Gets the number of elements in the collection. |
ErrorCount |
Gets the number of errors added to this instance of ModelStateDictionary via AddModelError or TryAddModelError. |
HasReachedMaxErrors |
Gets a value indicating whether or not the maximum number of errors have been recorded. |
IsValid |
Gets a value that indicates whether any model state values in this model state dictionary is invalid or not validated. |
Item[String] | Gets the element that has the specified key in the read-only dictionary. |
Keys |
Gets the key sequence. |
MaxAllowedErrors |
Gets or sets the maximum allowed model state errors in this instance of ModelStateDictionary.
Defaults to |
Root |
Root entry for the ModelStateDictionary. |
ValidationState | System.Object.ValidationState |
Values |
Gets the value sequence. |
Methods
AddModelError(String, Exception, ModelMetadata) |
Adds the specified |
AddModelError(String, String) |
Adds the specified |
Clear() |
Removes all keys and values from this instance of ModelStateDictionary. |
ClearValidationState(String) |
Clears ModelStateDictionary entries that match the key that is passed as parameter. |
ContainsKey(String) | Determines whether the read-only dictionary contains an element that has the specified key. |
FindKeysWithPrefix(String) |
Gets a ModelStateDictionary.PrefixEnumerable that iterates over this instance of ModelStateDictionary
using the specified |
GetEnumerator() |
Returns an enumerator that iterates through this instance of ModelStateDictionary. |
GetFieldValidationState(String) |
Returns the aggregate ModelValidationState for items starting with the
specified |
GetValidationState(String) |
Returns ModelValidationState for the |
MarkFieldSkipped(String) |
Marks the ValidationState for the entry with the specified |
MarkFieldValid(String) |
Marks the ValidationState for the entry with the specified
|
Merge(ModelStateDictionary) |
Copies the values from the specified |
Remove(String) |
Removes the ModelStateEntry with the specified |
SetModelValue(String, Object, String) |
Sets the of RawValue and AttemptedValue for
the ModelStateEntry with the specified |
SetModelValue(String, ValueProviderResult) |
Sets the value for the ModelStateEntry with the specified |
StartsWithPrefix(String, String) |
This API supports the MVC's infrastructure and is not intended to be used directly from your code. This API may change or be removed in future releases. |
TryAddModelError(String, Exception, ModelMetadata) |
Attempts to add the specified |
TryAddModelError(String, String) |
Attempts to add the specified |
TryAddModelException(String, Exception) |
Adds the specified |
TryGetValue(String, ModelStateEntry) | System.Object.TryGetValue(System.String,Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateEntry@) |
Explicit Interface Implementations
IEnumerable.GetEnumerator() | Returns an enumerator that iterates through a collection. |
IEnumerable<KeyValuePair<String,ModelStateEntry>>.GetEnumerator() | Returns an enumerator that iterates through the collection. |
IReadOnlyDictionary<String,ModelStateEntry>.Keys | Gets an enumerable collection that contains the keys in the read-only dictionary. |
IReadOnlyDictionary<String,ModelStateEntry>.Values | Gets an enumerable collection that contains the values in the read-only dictionary. |
Extension Methods
AddModelError<TModel>(ModelStateDictionary, Expression<Func<TModel,Object>>, Exception, ModelMetadata) |
Adds the specified |
AddModelError<TModel>(ModelStateDictionary, Expression<Func<TModel,Object>>, String) |
Adds the specified |
Remove<TModel>(ModelStateDictionary, Expression<Func<TModel,Object>>) |
Removes the specified |
RemoveAll<TModel>(ModelStateDictionary, Expression<Func<TModel,Object>>) |
Removes all the entries for the specified |
TryAddModelException<TModel>(ModelStateDictionary, Expression<Func<TModel,Object>>, Exception) |
Adds the specified |