Share via


DefaultModelBindingContext Class

Definition

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

public ref class DefaultModelBindingContext : Microsoft::AspNetCore::Mvc::ModelBinding::ModelBindingContext
public class DefaultModelBindingContext : Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext
type DefaultModelBindingContext = class
    inherit ModelBindingContext
Public Class DefaultModelBindingContext
Inherits ModelBindingContext
Inheritance
DefaultModelBindingContext

Constructors

DefaultModelBindingContext()

Initializes a new instance of the DefaultModelBindingContext class.

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.

(Inherited from ModelBindingContext)
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.

(Inherited from ModelBindingContext)
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.

(Inherited from ModelBindingContext)
OriginalValueProvider

Gets or sets the original value provider to be used when value providers are not filtered.

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

CreateBindingContext(ActionContext, IValueProvider, ModelMetadata, BindingInfo, String)

Creates a new DefaultModelBindingContext for top-level model binding operation.

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