ModelBindingResult Class

Summary

Contains the result of model binding.

Syntax

public class ModelBindingResult

GitHub

View on GitHub

class Microsoft.AspNet.Mvc.ModelBinding.ModelBindingResult

Constructors

ModelBindingResult(System.Object, System.String, System.Boolean)

Creates a new [Microsoft.AspNet.Mvc.ModelBinding.ModelBindingResult](Microsoft.AspNet.Mvc.ModelBinding.ModelBindingResult.yml).

Arguments:
  • model (System.Object) – The model which was created by the [Microsoft.AspNet.Mvc.ModelBinding.IModelBinder](Microsoft.AspNet.Mvc.ModelBinding.IModelBinder.yml).
  • key (System.String) – The key using which was used to attempt binding the model.
  • isModelSet (System.Boolean) – A value that represents if the model has been set by the [Microsoft.AspNet.Mvc.ModelBinding.IModelBinder](Microsoft.AspNet.Mvc.ModelBinding.IModelBinder.yml).
public ModelBindingResult(object model, string key, bool isModelSet)
ModelBindingResult(System.Object, System.String, System.Boolean, Microsoft.AspNet.Mvc.ModelBinding.ModelValidationNode)

Creates a new [Microsoft.AspNet.Mvc.ModelBinding.ModelBindingResult](Microsoft.AspNet.Mvc.ModelBinding.ModelBindingResult.yml).

Arguments:
  • model (System.Object) – The model which was created by the [Microsoft.AspNet.Mvc.ModelBinding.IModelBinder](Microsoft.AspNet.Mvc.ModelBinding.IModelBinder.yml).
  • key (System.String) – The key using which was used to attempt binding the model.
  • isModelSet (System.Boolean) – A value that represents if the model has been set by the [Microsoft.AspNet.Mvc.ModelBinding.IModelBinder](Microsoft.AspNet.Mvc.ModelBinding.IModelBinder.yml).
  • validationNode (Microsoft.AspNet.Mvc.ModelBinding.ModelValidationNode) – A [Microsoft.AspNet.Mvc.ModelBinding.ModelValidationNode](Microsoft.AspNet.Mvc.ModelBinding.ModelValidationNode.yml) which captures the validation information.
public ModelBindingResult(object model, string key, bool isModelSet, ModelValidationNode validationNode)
ModelBindingResult(System.String)

Creates a new [Microsoft.AspNet.Mvc.ModelBinding.ModelBindingResult](Microsoft.AspNet.Mvc.ModelBinding.ModelBindingResult.yml) indicating a fatal error.

Arguments:
  • key (System.String) – The key using which was used to attempt binding the model.
public ModelBindingResult(string key)

Properties

IsFatalError()

Gets a value indicating the caller should not attempt binding again. This attempt encountered a fatal error.

Return type:System.Boolean
public bool IsFatalError { get; }
IsModelSet()

<para> Gets a value indicating whether or not the <see cref=”P:Microsoft.AspNet.Mvc.ModelBinding.ModelBindingResult.Model” /> value has been set. </para> <para> This property can be used to distinguish between a model binder which does not find a value and the case where a model binder sets the <c>null</c> value. </para>

Return type:System.Boolean
public bool IsModelSet { get; }
Key()

<para> Gets the model name which was used to bind the model. </para> <para> This property can be used during validation to add model state for a bound model. </para>

Return type:System.String
public string Key { get; }
Model()

Gets the model associated with this context.

Return type:System.Object
public object Model { get; }
ValidationNode()

A [Microsoft.AspNet.Mvc.ModelBinding.ModelValidationNode](Microsoft.AspNet.Mvc.ModelBinding.ModelValidationNode.yml) associated with the current [Microsoft.AspNet.Mvc.ModelBinding.ModelBindingResult](Microsoft.AspNet.Mvc.ModelBinding.ModelBindingResult.yml).

Return type:Microsoft.AspNet.Mvc.ModelBinding.ModelValidationNode
public ModelValidationNode ValidationNode { get; }