Share via


CollectionModelBinder<TElement> Class

Definition

IModelBinder implementation for binding collection values.

generic <typename TElement>
public ref class CollectionModelBinder : Microsoft::AspNetCore::Mvc::ModelBinding::ICollectionModelBinder, Microsoft::AspNetCore::Mvc::ModelBinding::IModelBinder
public class CollectionModelBinder<TElement> : Microsoft.AspNetCore.Mvc.ModelBinding.ICollectionModelBinder, Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder
type CollectionModelBinder<'Element> = class
    interface ICollectionModelBinder
    interface IModelBinder
Public Class CollectionModelBinder(Of TElement)
Implements ICollectionModelBinder, IModelBinder

Type Parameters

TElement

Type of elements in the collection.

Inheritance
CollectionModelBinder<TElement>
Derived
Implements

Constructors

CollectionModelBinder<TElement>(IModelBinder, ILoggerFactory, Boolean, MvcOptions)

Creates a new CollectionModelBinder<TElement>.

CollectionModelBinder<TElement>(IModelBinder, ILoggerFactory, Boolean)

Creates a new CollectionModelBinder<TElement>.

CollectionModelBinder<TElement>(IModelBinder, ILoggerFactory)

Creates a new CollectionModelBinder<TElement>.

CollectionModelBinder<TElement>(IModelBinder)
Obsolete.

This constructor is obsolete and will be removed in a future version. The recommended alternative is the overload that also takes an ILoggerFactory.

Creates a new CollectionModelBinder<TElement>.

Properties

ElementBinder

Gets the IModelBinder instances for binding collection elements.

Logger

The ILogger used for logging in this binder.

Methods

AddErrorIfBindingRequired(ModelBindingContext)

Add a ModelError to ModelState if IsBindingRequired.

BindModelAsync(ModelBindingContext)

Attempts to bind a model.

CanCreateInstance(Type)

Gets an indication whether or not this ICollectionModelBinder implementation can create an Object assignable to targetType.

ConvertToCollectionType(Type, IEnumerable<TElement>)

Gets an Object assignable to targetType that contains members from collection.

CopyToModel(Object, IEnumerable<TElement>)

Adds values from sourceCollection to given target.

CreateEmptyCollection(Type)

Create an Object assignable to targetType.

CreateInstance(Type)

Create an instance of targetType.

Applies to