ViewDataDictionary 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
ViewDataDictionary(ViewDataDictionary) |
完全基于现有实例 ViewDataDictionary 初始化 类的新实例。 |
ViewDataDictionary(IModelMetadataProvider, ModelStateDictionary) |
初始化 ViewDataDictionary 类的新实例。 |
ViewDataDictionary(IModelMetadataProvider, Type) |
初始化 ViewDataDictionary 类的新实例。 |
ViewDataDictionary(ViewDataDictionary, Type) |
部分基于现有实例 ViewDataDictionary 初始化 类的新实例。 |
ViewDataDictionary(IModelMetadataProvider, ModelStateDictionary, Type) |
初始化 ViewDataDictionary 类的新实例。 |
ViewDataDictionary(ViewDataDictionary, Object, Type) |
部分基于现有实例 ViewDataDictionary 初始化 类的新实例。 此构造函数小心避免在 为 |
ViewDataDictionary(ViewDataDictionary)
- Source:
- ViewDataDictionary.cs
- Source:
- ViewDataDictionary.cs
- Source:
- ViewDataDictionary.cs
完全基于现有实例 ViewDataDictionary 初始化 类的新实例。
public:
ViewDataDictionary(Microsoft::AspNetCore::Mvc::ViewFeatures::ViewDataDictionary ^ source);
public ViewDataDictionary (Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary source);
new Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary : Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary -> Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary
Public Sub New (source As ViewDataDictionary)
参数
- source
- ViewDataDictionary
ViewDataDictionary 要从中复制初始值的实例。
注解
用于复制ViewDataDictionary实例和声明TypeModel的 不会更改,例如从ViewDataDictionary<TModel>实例复制到基ViewDataDictionary实例时。
不应将此构造函数用于可能设置为与 声明类型source
不兼容的值的任何上下文Model中。
适用于
ViewDataDictionary(IModelMetadataProvider, ModelStateDictionary)
- Source:
- ViewDataDictionary.cs
- Source:
- ViewDataDictionary.cs
- Source:
- ViewDataDictionary.cs
初始化 ViewDataDictionary 类的新实例。
public:
ViewDataDictionary(Microsoft::AspNetCore::Mvc::ModelBinding::IModelMetadataProvider ^ metadataProvider, Microsoft::AspNetCore::Mvc::ModelBinding::ModelStateDictionary ^ modelState);
public ViewDataDictionary (Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider metadataProvider, Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary modelState);
new Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary : Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider * Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary -> Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary
Public Sub New (metadataProvider As IModelMetadataProvider, modelState As ModelStateDictionary)
参数
- metadataProvider
- IModelMetadataProvider
IModelMetadataProvider 用于创建 ModelExplorer 实例的实例。
- modelState
- ModelStateDictionary
ModelStateDictionary 此范围的实例。
注解
在为新的顶级范围创建 ViewDataDictionary 时使用。
适用于
ViewDataDictionary(IModelMetadataProvider, Type)
- Source:
- ViewDataDictionary.cs
- Source:
- ViewDataDictionary.cs
- Source:
- ViewDataDictionary.cs
初始化 ViewDataDictionary 类的新实例。
protected:
ViewDataDictionary(Microsoft::AspNetCore::Mvc::ModelBinding::IModelMetadataProvider ^ metadataProvider, Type ^ declaredModelType);
protected ViewDataDictionary (Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider metadataProvider, Type declaredModelType);
new Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary : Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider * Type -> Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary
Protected Sub New (metadataProvider As IModelMetadataProvider, declaredModelType As Type)
参数
- metadataProvider
- IModelMetadataProvider
IModelMetadataProvider 用于创建 ModelExplorer 实例的实例。
- declaredModelType
- Type
Type预期值的 。Model 用于设置 ModelMetadata。
注解
在为新的顶级范围创建派生 ViewDataDictionary 时使用。
适用于
ViewDataDictionary(ViewDataDictionary, Type)
- Source:
- ViewDataDictionary.cs
- Source:
- ViewDataDictionary.cs
- Source:
- ViewDataDictionary.cs
部分基于现有实例 ViewDataDictionary 初始化 类的新实例。
protected:
ViewDataDictionary(Microsoft::AspNetCore::Mvc::ViewFeatures::ViewDataDictionary ^ source, Type ^ declaredModelType);
protected ViewDataDictionary (Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary source, Type declaredModelType);
new Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary : Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary * Type -> Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary
Protected Sub New (source As ViewDataDictionary, declaredModelType As Type)
参数
- source
- ViewDataDictionary
ViewDataDictionary 要从中复制初始值的实例。
- declaredModelType
- Type
Type预期值的 。Model 用于设置 ModelMetadata。
注解
在复制 ViewDataDictionary 实例和声明 ModelType 的新实例时使用,但 Model 应从现有实例复制,例如从基 ViewDataDictionary 实例复制到 ViewDataDictionary<TModel> 实例时。
如果 为非null
且与 不兼容,则此构造函数可能throw
。declaredModelType
source.Model
将 传递给 model: null
以 ViewDataDictionary(ViewDataDictionary, Object, Type) 忽略 source.Model
。
适用于
ViewDataDictionary(IModelMetadataProvider, ModelStateDictionary, Type)
- Source:
- ViewDataDictionary.cs
- Source:
- ViewDataDictionary.cs
- Source:
- ViewDataDictionary.cs
初始化 ViewDataDictionary 类的新实例。
protected:
ViewDataDictionary(Microsoft::AspNetCore::Mvc::ModelBinding::IModelMetadataProvider ^ metadataProvider, Microsoft::AspNetCore::Mvc::ModelBinding::ModelStateDictionary ^ modelState, Type ^ declaredModelType);
protected ViewDataDictionary (Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider metadataProvider, Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary modelState, Type declaredModelType);
new Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary : Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider * Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary * Type -> Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary
Protected Sub New (metadataProvider As IModelMetadataProvider, modelState As ModelStateDictionary, declaredModelType As Type)
参数
- metadataProvider
- IModelMetadataProvider
IModelMetadataProvider 用于创建 ModelExplorer 实例的实例。
- modelState
- ModelStateDictionary
ModelStateDictionary 此范围的实例。
- declaredModelType
- Type
Type预期值的 。Model 用于设置 ModelMetadata。
注解
在为新的顶级范围创建派生 ViewDataDictionary 时使用。
适用于
ViewDataDictionary(ViewDataDictionary, Object, Type)
- Source:
- ViewDataDictionary.cs
- Source:
- ViewDataDictionary.cs
- Source:
- ViewDataDictionary.cs
部分基于现有实例 ViewDataDictionary 初始化 类的新实例。 此构造函数小心避免在 为 null
时model
可能会引发异常SetModel(Object)。
protected:
ViewDataDictionary(Microsoft::AspNetCore::Mvc::ViewFeatures::ViewDataDictionary ^ source, System::Object ^ model, Type ^ declaredModelType);
protected ViewDataDictionary (Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary source, object model, Type declaredModelType);
protected ViewDataDictionary (Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary source, object? model, Type declaredModelType);
new Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary : Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary * obj * Type -> Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary
Protected Sub New (source As ViewDataDictionary, model As Object, declaredModelType As Type)
参数
- source
- ViewDataDictionary
ViewDataDictionary 要从中复制初始值的实例。
- declaredModelType
- Type
Type预期值的 。Model 用于设置 ModelMetadata。
注解
在复制 ViewDataDictionary 实例和新实例的声明 ModelType 和 Model 已知时使用。
如果 为非null
且与 不兼容,则此构造函数可能throw
。declaredModelType
model