DbContextInfo 构造函数 (Type, ConnectionStringSettingsCollection)

[本页针对的是实体框架版本 6。最新版本以“实体框架”NuGet 包的形式提供。有关实体框架的更多信息,请参见 msdn.com/data/ef。]

注意:此 API 现在已过时。

通过使用指定上下文类型和连接字符串的设置来初始化 DbContextInfo 类。

命名空间:  System.Data.Entity.Infrastructure
程序集:  EntityFramework(在 EntityFramework.dll 中)

语法

声明
<ObsoleteAttribute("The application configuration can contain multiple settings that affect the connection used by a DbContext. To ensure all configuration is taken into account, use a DbContextInfo constructor that accepts System.Configuration.Configuration")> _
Public Sub New ( _
    contextType As Type, _
    connectionStringSettings As ConnectionStringSettingsCollection _
)
用法
Dim contextType As Type 
Dim connectionStringSettings As ConnectionStringSettingsCollection 

Dim instance As New DbContextInfo(contextType, _
    connectionStringSettings)
[ObsoleteAttribute("The application configuration can contain multiple settings that affect the connection used by a DbContext. To ensure all configuration is taken into account, use a DbContextInfo constructor that accepts System.Configuration.Configuration")]
public DbContextInfo(
    Type contextType,
    ConnectionStringSettingsCollection connectionStringSettings
)
[ObsoleteAttribute(L"The application configuration can contain multiple settings that affect the connection used by a DbContext. To ensure all configuration is taken into account, use a DbContextInfo constructor that accepts System.Configuration.Configuration")]
public:
DbContextInfo(
    Type^ contextType, 
    ConnectionStringSettingsCollection^ connectionStringSettings
)
[<ObsoleteAttribute("The application configuration can contain multiple settings that affect the connection used by a DbContext. To ensure all configuration is taken into account, use a DbContextInfo constructor that accepts System.Configuration.Configuration")>]
new : 
        contextType:Type * 
        connectionStringSettings:ConnectionStringSettingsCollection -> DbContextInfo
public function DbContextInfo(
    contextType : Type, 
    connectionStringSettings : ConnectionStringSettingsCollection
)

参数

备注

更倾向使用接受整个配置文档的构造函数而非使用此构造函数。 提供整个配置文档将允许除了显式指定的连接字符串外,还可以在配置文档中找到 DefaultConnectionFactroy 项。

请参阅

参考

DbContextInfo 类

DbContextInfo 重载

System.Data.Entity.Infrastructure 命名空间