Table of Contents

Class MutableObjectModelBinder

Namespace
System.Web.Http.ModelBinding.Binders
Assembly
System.Web.Http.dll

Maps a browser request to a mutable data object.

public class MutableObjectModelBinder : IModelBinder
Inheritance
MutableObjectModelBinder
Implements
Inherited Members

Constructors

MutableObjectModelBinder()

Initializes a new instance of the MutableObjectModelBinder class.

public MutableObjectModelBinder()

Methods

BindModel(HttpActionContext, ModelBindingContext)

Binds the model by using the specified action context and binding context.

public virtual bool BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext)

Parameters

actionContext HttpActionContext

The action context.

bindingContext ModelBindingContext

The binding context.

Returns

bool

true if binding is successful; otherwise, false.

CanUpdateProperty(ModelMetadata)

Retrieves a value that indicates whether a property can be updated.

protected virtual bool CanUpdateProperty(ModelMetadata propertyMetadata)

Parameters

propertyMetadata ModelMetadata

The metadata for the property to be evaluated.

Returns

bool

true if the property can be updated; otherwise, false.

CreateModel(HttpActionContext, ModelBindingContext)

Creates an instance of the model.

protected virtual object CreateModel(HttpActionContext actionContext, ModelBindingContext bindingContext)

Parameters

actionContext HttpActionContext

The action context.

bindingContext ModelBindingContext

The binding context.

Returns

object

The newly created model object.

EnsureModel(HttpActionContext, ModelBindingContext)

Creates a model instance if an instance does not yet exist in the binding context.

protected virtual void EnsureModel(HttpActionContext actionContext, ModelBindingContext bindingContext)

Parameters

actionContext HttpActionContext

The action context.

bindingContext ModelBindingContext

The binding context.

GetMetadataForProperties(HttpActionContext, ModelBindingContext)

Retrieves metadata for properties of the model.

protected virtual IEnumerable<ModelMetadata> GetMetadataForProperties(HttpActionContext actionContext, ModelBindingContext bindingContext)

Parameters

actionContext HttpActionContext

The action context.

bindingContext ModelBindingContext

The binding context.

Returns

IEnumerable<ModelMetadata>

The metadata for properties of the model.

SetProperty(HttpActionContext, ModelBindingContext, ModelMetadata, ComplexModelDtoResult, ModelValidator)

Sets the value of a specified property.

protected virtual void SetProperty(HttpActionContext actionContext, ModelBindingContext bindingContext, ModelMetadata propertyMetadata, ComplexModelDtoResult dtoResult, ModelValidator requiredValidator)

Parameters

actionContext HttpActionContext

The action context.

bindingContext ModelBindingContext

The binding context.

propertyMetadata ModelMetadata

The metadata for the property to set.

dtoResult ComplexModelDtoResult

The validation information about the property.

requiredValidator ModelValidator

The validator for the model.