C# Class Microsoft.Web.Mvc.DataAnnotations.DataAnnotationsModelBinder

An implementation of IModelBinder which is designed to be a replacement default model binder, adding the functionality of validation via the validation attributes in System.ComponentModel.DataAnnotations from .NET 4.0.
Inheritance: System.Web.Mvc.DefaultModelBinder
Mostrar archivo Open project: fellowshiptech/ft-iserve

Protected Methods

Method Description
BindProperty ( System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor ) : void
GetModelProperties ( System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ModelBindingContext bindingContext ) : PropertyDescriptorCollection
OnModelUpdated ( System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ModelBindingContext bindingContext ) : void
OnPropertyValidating ( System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor, object value ) : bool

Private Methods

Method Description
CanUpdateReadonlyTypedReference ( Type type ) : bool
ConvertValue ( PropertyDescriptor propertyDescriptor, object value ) : object

Converts a data value. Looks for the DisplayFormatAttribute to determine if empty strings should be converted to nulls (true by default).

GetDisplayName ( ICustomTypeDescriptor descriptor ) : string

Gets the display name for a class. Looks for the DisplayNameAttribute attribute, and falls back to the class's name by default.

GetDisplayName ( PropertyDescriptor descriptor ) : string

Gets the display name for a property. Looks for the DisplayAttribute attribute, then the DisplayNameAttribute attribute, and finally falls back to the property's name by default.

GetTypeDescriptor ( object model, Type modelType ) : ICustomTypeDescriptor

Gets the model's type descriptor. In order to support the buddy class metadata model for LINQ to SQL and Entity Framework, it uses AssociatedMetadataTypeTypeDescriptionProvider.

GetValidationAttributes ( PropertyDescriptor propertyDescriptor ) : IEnumerable
ModelIsValid ( System.Web.Mvc.ModelBindingContext bindingContext ) : bool
ShouldUpdateProperty ( PropertyDescriptor property, Predicate propertyFilter ) : bool
TypeAllowsNullValue ( Type type ) : bool

Method Details

BindProperty() protected method

protected BindProperty ( System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor ) : void
controllerContext System.Web.Mvc.ControllerContext
bindingContext System.Web.Mvc.ModelBindingContext
propertyDescriptor System.ComponentModel.PropertyDescriptor
return void

GetModelProperties() protected method

protected GetModelProperties ( System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ModelBindingContext bindingContext ) : PropertyDescriptorCollection
controllerContext System.Web.Mvc.ControllerContext
bindingContext System.Web.Mvc.ModelBindingContext
return System.ComponentModel.PropertyDescriptorCollection

OnModelUpdated() protected method

protected OnModelUpdated ( System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ModelBindingContext bindingContext ) : void
controllerContext System.Web.Mvc.ControllerContext
bindingContext System.Web.Mvc.ModelBindingContext
return void

OnPropertyValidating() protected method

protected OnPropertyValidating ( System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor, object value ) : bool
controllerContext System.Web.Mvc.ControllerContext
bindingContext System.Web.Mvc.ModelBindingContext
propertyDescriptor System.ComponentModel.PropertyDescriptor
value object
return bool