ViewDataDictionary 构造函数

定义

重载

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基于现有实例的部分初始化类的新实例。 SetModel(Object)modelnull时,此构造函数将小心避免可能引发异常。

ViewDataDictionary(ViewDataDictionary)

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 ,在将实例 Model TypeViewDataDictionary<TModel> 实例复制到基实例时,将不会更改。 ViewDataDictionary

不应在 Model 可能设置为与声明的类型不兼容的值的任何上下文中使用此构造函数 source

适用于

ViewDataDictionary(IModelMetadataProvider, ModelStateDictionary)

初始化 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)

初始化 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)

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 实例和声明的新实例时使用, Model TypeModel 应从现有实例复制,例如从基 ViewDataDictionary 实例复制到实例时。 ViewDataDictionary<TModel>

如果源为,则此构造函数可能会 引发 。模型 为非null ,并且与不兼容 declaredModelType 。 传递 模型: nullViewDataDictionary(ViewDataDictionary, Object, Type) 以忽略 源。模型

适用于

ViewDataDictionary(IModelMetadataProvider, ModelStateDictionary, Type)

初始化 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)

ViewDataDictionary基于现有实例的部分初始化类的新实例。 SetModel(Object)modelnull时,此构造函数将小心避免可能引发异常。

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 要从中复制初始值的实例。

model
Object

属性的值 Model

declaredModelType
Type

Type 应为的 Model 值。 用于设置 ModelMetadata

注解

用于复制 ViewDataDictionary 实例,并为其声明 Model Type 和已知时使用 Model

如果 model 为非null并且与不兼容,则此构造函数可能引发 declaredModelType

适用于