DictionaryModelBinder<TKey,TValue> 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
DictionaryModelBinder<TKey,TValue>(IModelBinder, IModelBinder)
警告
This constructor is obsolete and will be removed in a future version. The recommended alternative is the overload that also takes an ILoggerFactory.
此建構函式已過時,未來版本將會移除。 建議的替代方案是也採用 ILoggerFactory 的多載。
public:
DictionaryModelBinder(Microsoft::AspNetCore::Mvc::ModelBinding::IModelBinder ^ keyBinder, Microsoft::AspNetCore::Mvc::ModelBinding::IModelBinder ^ valueBinder);
public DictionaryModelBinder (Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder keyBinder, Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder valueBinder);
[System.Obsolete("This constructor is obsolete and will be removed in a future version. The recommended alternative is the overload that also takes an ILoggerFactory.")]
public DictionaryModelBinder (Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder keyBinder, Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder valueBinder);
new Microsoft.AspNetCore.Mvc.ModelBinding.Binders.DictionaryModelBinder<'Key, 'Value> : Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder * Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder -> Microsoft.AspNetCore.Mvc.ModelBinding.Binders.DictionaryModelBinder<'Key, 'Value>
[<System.Obsolete("This constructor is obsolete and will be removed in a future version. The recommended alternative is the overload that also takes an ILoggerFactory.")>]
new Microsoft.AspNetCore.Mvc.ModelBinding.Binders.DictionaryModelBinder<'Key, 'Value> : Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder * Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder -> Microsoft.AspNetCore.Mvc.ModelBinding.Binders.DictionaryModelBinder<'Key, 'Value>
Public Sub New (keyBinder As IModelBinder, valueBinder As IModelBinder)
參數
- keyBinder
- IModelBinder
TKey
的 IModelBinder。
- valueBinder
- IModelBinder
TValue
的 IModelBinder。
- 屬性
適用於
DictionaryModelBinder<TKey,TValue>(IModelBinder, IModelBinder, ILoggerFactory)
public:
DictionaryModelBinder(Microsoft::AspNetCore::Mvc::ModelBinding::IModelBinder ^ keyBinder, Microsoft::AspNetCore::Mvc::ModelBinding::IModelBinder ^ valueBinder, Microsoft::Extensions::Logging::ILoggerFactory ^ loggerFactory);
public DictionaryModelBinder (Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder keyBinder, Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder valueBinder, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory);
new Microsoft.AspNetCore.Mvc.ModelBinding.Binders.DictionaryModelBinder<'Key, 'Value> : Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder * Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder * Microsoft.Extensions.Logging.ILoggerFactory -> Microsoft.AspNetCore.Mvc.ModelBinding.Binders.DictionaryModelBinder<'Key, 'Value>
Public Sub New (keyBinder As IModelBinder, valueBinder As IModelBinder, loggerFactory As ILoggerFactory)
參數
- keyBinder
- IModelBinder
TKey
的 IModelBinder。
- valueBinder
- IModelBinder
TValue
的 IModelBinder。
- loggerFactory
- ILoggerFactory
備註
即使 是 true
,系結器也不會為未系結的最上層模型 IsBindingRequired 新增錯誤。
適用於
DictionaryModelBinder<TKey,TValue>(IModelBinder, IModelBinder, ILoggerFactory, Boolean)
public:
DictionaryModelBinder(Microsoft::AspNetCore::Mvc::ModelBinding::IModelBinder ^ keyBinder, Microsoft::AspNetCore::Mvc::ModelBinding::IModelBinder ^ valueBinder, Microsoft::Extensions::Logging::ILoggerFactory ^ loggerFactory, bool allowValidatingTopLevelNodes);
public DictionaryModelBinder (Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder keyBinder, Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder valueBinder, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, bool allowValidatingTopLevelNodes);
new Microsoft.AspNetCore.Mvc.ModelBinding.Binders.DictionaryModelBinder<'Key, 'Value> : Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder * Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder * Microsoft.Extensions.Logging.ILoggerFactory * bool -> Microsoft.AspNetCore.Mvc.ModelBinding.Binders.DictionaryModelBinder<'Key, 'Value>
Public Sub New (keyBinder As IModelBinder, valueBinder As IModelBinder, loggerFactory As ILoggerFactory, allowValidatingTopLevelNodes As Boolean)
參數
- keyBinder
- IModelBinder
TKey
的 IModelBinder。
- valueBinder
- IModelBinder
TValue
的 IModelBinder。
- loggerFactory
- ILoggerFactory
- allowValidatingTopLevelNodes
- Boolean
指出已啟用最上層模型的驗證。 如果 true
和 IsBindingRequired 適用于 true
最上層模型,系結器會在模型未系結時新增 ModelStateDictionary 錯誤。
備註
參數 allowValidatingTopLevelNodes
目前會被忽略。
Microsoft.AspNetCore.Mvc.ModelBinding.Binders.CollectionModelBinder`1.AllowValidatingTopLevelNodes 一律 false
在 中 DictionaryModelBinder<TKey,TValue> 。 這個類別會忽略該屬性,並以 無條件地檢查未系結的最上層模型 IsBindingRequired 。
適用於
DictionaryModelBinder<TKey,TValue>(IModelBinder, IModelBinder, ILoggerFactory, Boolean, MvcOptions)
public:
DictionaryModelBinder(Microsoft::AspNetCore::Mvc::ModelBinding::IModelBinder ^ keyBinder, Microsoft::AspNetCore::Mvc::ModelBinding::IModelBinder ^ valueBinder, Microsoft::Extensions::Logging::ILoggerFactory ^ loggerFactory, bool allowValidatingTopLevelNodes, Microsoft::AspNetCore::Mvc::MvcOptions ^ mvcOptions);
public DictionaryModelBinder (Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder keyBinder, Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder valueBinder, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, bool allowValidatingTopLevelNodes, Microsoft.AspNetCore.Mvc.MvcOptions mvcOptions);
new Microsoft.AspNetCore.Mvc.ModelBinding.Binders.DictionaryModelBinder<'Key, 'Value> : Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder * Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder * Microsoft.Extensions.Logging.ILoggerFactory * bool * Microsoft.AspNetCore.Mvc.MvcOptions -> Microsoft.AspNetCore.Mvc.ModelBinding.Binders.DictionaryModelBinder<'Key, 'Value>
Public Sub New (keyBinder As IModelBinder, valueBinder As IModelBinder, loggerFactory As ILoggerFactory, allowValidatingTopLevelNodes As Boolean, mvcOptions As MvcOptions)
參數
- keyBinder
- IModelBinder
TKey
的 IModelBinder。
- valueBinder
- IModelBinder
TValue
的 IModelBinder。
- loggerFactory
- ILoggerFactory
- allowValidatingTopLevelNodes
- Boolean
指出已啟用最上層模型的驗證。 如果 true
和 IsBindingRequired 適用于 true
最上層模型,系結器會在模型未系結時新增 ModelStateDictionary 錯誤。
- mvcOptions
- MvcOptions
備註
這是慣用 DictionaryModelBinder<TKey,TValue> 的建構函式。
參數 allowValidatingTopLevelNodes
目前會被忽略。
Microsoft.AspNetCore.Mvc.ModelBinding.Binders.CollectionModelBinder`1.AllowValidatingTopLevelNodes 一律 false
在 中 DictionaryModelBinder<TKey,TValue> 。 這個類別會忽略該屬性,並以 無條件地檢查未系結的最上層模型 IsBindingRequired 。