C# Class Qowaiv.Web.Mvc.TypeConverterModelBinder

A modelbinder for types with a custom type converter.
This binder supports models that have there own TypeConverter. The message of the exception thrown by there type converter in case of failure is the error message added to the model state. This binder is needed because the default modelbinder don't call a type converter in case the input is String.Empty.
Inheritance: System.Web.Mvc.DefaultModelBinder
Mostra file Open project: Corniel/Qowaiv

Public Methods

Method Description
AddAssembly ( Assembly assembly ) : void

Adds the types of the assembly that are marked with teh SingleValueObjectAttribute.

AddType ( Type tp ) : void

Adds the specified type.

Only adds the types that are supported by the model binder.

AddTypes ( ) : void

Adds the specified types.

Only adds the types that are supported by the model binder.

RegisterForAll ( ModelBinderDictionary binders ) : void

Registers the model binder to the specified model binder dictionary.

Typical usage: protected override void Application_Start() { base.Application_Start(); TypeConverterModelBinder.RegisterForAll(ModelBinders.Binders); }

RemoveType ( Type tp ) : void

Removes the specified type.

Private Methods

Method Description
BindModel ( System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ModelBindingContext bindingContext ) : object
TypeConverterModelBinder ( ) : System

Method Details

AddAssembly() public static method

Adds the types of the assembly that are marked with teh SingleValueObjectAttribute.
public static AddAssembly ( Assembly assembly ) : void
assembly System.Reflection.Assembly /// Assembly to add. ///
return void

AddType() public static method

Adds the specified type.
Only adds the types that are supported by the model binder.
public static AddType ( Type tp ) : void
tp System.Type /// Type to add. ///
return void

AddTypes() public static method

Adds the specified types.
Only adds the types that are supported by the model binder.
public static AddTypes ( ) : void
return void

RegisterForAll() public static method

Registers the model binder to the specified model binder dictionary.
Typical usage: protected override void Application_Start() { base.Application_Start(); TypeConverterModelBinder.RegisterForAll(ModelBinders.Binders); }
public static RegisterForAll ( ModelBinderDictionary binders ) : void
binders ModelBinderDictionary The model binder dictionary to add to.
return void

RemoveType() public static method

Removes the specified type.
public static RemoveType ( Type tp ) : void
tp System.Type /// Type to remove. ///
return void