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
Afficher le fichier Open project: Corniel/Qowaiv

Méthodes publiques

Méthode 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

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

Method Details

AddAssembly() public static méthode

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. ///
Résultat void

AddType() public static méthode

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. ///
Résultat void

AddTypes() public static méthode

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

RegisterForAll() public static méthode

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.
Résultat void

RemoveType() public static méthode

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