Class CollectionModelBinder<TElement>
- Namespace
- System.Web.Http.ModelBinding.Binders
- Assembly
- System.Web.Http.dll
Maps a browser request to a collection.
public class CollectionModelBinder<TElement> : IModelBinder
Type Parameters
TElementThe type of the collection.
- Inheritance
-
CollectionModelBinder<TElement>
- Implements
- Derived
- Inherited Members
Constructors
CollectionModelBinder()
Initializes a new instance of the CollectionModelBinder<TElement> class.
public CollectionModelBinder()
Methods
BindModel(HttpActionContext, ModelBindingContext)
Binds the model by using the specified execution context and binding context.
public virtual bool BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext)
Parameters
actionContextHttpActionContextThe action context.
bindingContextModelBindingContextThe binding context.
Returns
- bool
true if model binding is successful; otherwise, false.
CreateOrReplaceCollection(HttpActionContext, ModelBindingContext, IList<TElement>)
Provides a way for derived classes to manipulate the collection before returning it from the binder.
protected virtual bool CreateOrReplaceCollection(HttpActionContext actionContext, ModelBindingContext bindingContext, IList<TElement> newCollection)
Parameters
actionContextHttpActionContextThe action context.
bindingContextModelBindingContextThe binding context.
newCollectionIList<TElement>The new collection.
Returns
- bool
true in all cases.