Delen via


ModelBindingContext Class

Definition

A context that contains operating information for model binding and validation.

public ref class ModelBindingContext abstract
public abstract class ModelBindingContext
type ModelBindingContext = class
Public MustInherit Class ModelBindingContext
Inheritance
ModelBindingContext
Derived

Constructors

ModelBindingContext()

Properties

ActionContext

Represents the ActionContext associated with this context.

BinderModelName

Gets or sets a model name which is explicitly set using an IModelNameProvider.

BindingSource

Gets or sets a value which represents the BindingSource associated with the Model.

FieldName

Gets or sets the name of the current field being bound.

HttpContext

Gets the HttpContext associated with this context.

IsTopLevelObject

Gets or sets an indication that the current binder is handling the top-level object.

Model

Gets or sets the model value for the current operation.

ModelMetadata

Gets or sets the metadata for the model associated with this context.

ModelName

Gets or sets the name of the model. This property is used as a key for looking up values in IValueProvider during model binding.

ModelState

Gets or sets the ModelStateDictionary used to capture ModelStateEntry values for properties in the object graph of the model when binding.

ModelType

Gets the type of the model.

OriginalModelName

Gets or sets the name of the top-level model. This is not reset to Empty when value providers have no match for that model.

PropertyFilter

Gets or sets a predicate which will be evaluated for each property to determine if the property is eligible for model binding.

Result

Gets or sets a ModelBindingResult which represents the result of the model binding process.

Before an IModelBinder is called, Result will be set to a value indicating failure. The binder should set Result to a value created with Success(Object) if model binding succeeded.

ValidationState

Gets or sets the ValidationStateDictionary. Used for tracking validation state to customize validation behavior for a model object.

ValueProvider

Gets or sets the IValueProvider associated with this context.

Methods

EnterNestedScope()

Pushes a layer of state onto this context. IModelBinder implementations will call this as part of recursion when binding properties or collection items.

EnterNestedScope(ModelMetadata, String, String, Object)

Pushes a layer of state onto this context. IModelBinder implementations will call this as part of recursion when binding properties or collection items.

ExitNestedScope()

Removes a layer of state pushed by calling EnterNestedScope.

Applies to