Dela via


DictionaryModelBinder<TKey,TValue> Class

Definition

IModelBinder implementation for binding dictionary values.

generic <typename TKey, typename TValue>
public ref class DictionaryModelBinder : Microsoft::AspNetCore::Mvc::ModelBinding::Binders::CollectionModelBinder<System::Collections::Generic::KeyValuePair<TKey, TValue>>
public class DictionaryModelBinder<TKey,TValue> : Microsoft.AspNetCore.Mvc.ModelBinding.Binders.CollectionModelBinder<System.Collections.Generic.KeyValuePair<TKey,TValue>>
type DictionaryModelBinder<'Key, 'Value> = class
    inherit CollectionModelBinder<KeyValuePair<'Key, 'Value>>
Public Class DictionaryModelBinder(Of TKey, TValue)
Inherits CollectionModelBinder(Of KeyValuePair(Of TKey, TValue))

Type Parameters

TKey

Type of keys in the dictionary.

TValue

Type of values in the dictionary.

Inheritance
DictionaryModelBinder<TKey,TValue>

Constructors

DictionaryModelBinder<TKey,TValue>(IModelBinder, IModelBinder, ILoggerFactory, Boolean, MvcOptions)

Creates a new DictionaryModelBinder<TKey,TValue>.

DictionaryModelBinder<TKey,TValue>(IModelBinder, IModelBinder, ILoggerFactory, Boolean)

Creates a new DictionaryModelBinder<TKey,TValue>.

DictionaryModelBinder<TKey,TValue>(IModelBinder, IModelBinder, ILoggerFactory)

Creates a new DictionaryModelBinder<TKey,TValue>.

DictionaryModelBinder<TKey,TValue>(IModelBinder, 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 DictionaryModelBinder<TKey,TValue>.

Properties

ElementBinder

Gets the IModelBinder instances for binding collection elements.

(Inherited from CollectionModelBinder<TElement>)
Logger

The ILogger used for logging in this binder.

(Inherited from CollectionModelBinder<TElement>)

Methods

AddErrorIfBindingRequired(ModelBindingContext)

Add a ModelError to ModelState if IsBindingRequired.

(Inherited from CollectionModelBinder<TElement>)
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<KeyValuePair<TKey,TValue>>) System.Object.ConvertToCollectionType(System.Type,System.Collections.Generic.IEnumerable{System.Collections.Generic.KeyValuePair{`0,`1}})
ConvertToCollectionType(Type, IEnumerable<TElement>)

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

(Inherited from CollectionModelBinder<TElement>)
CopyToModel(Object, IEnumerable<TElement>)

Adds values from sourceCollection to given target.

(Inherited from CollectionModelBinder<TElement>)
CreateEmptyCollection(Type)

Create an Object assignable to targetType.

CreateInstance(Type)

Create an instance of targetType.

(Inherited from CollectionModelBinder<TElement>)

Applies to