DbContextInfo 构造函数  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| DbContextInfo(Type) | 创建表示给定 DbContext 类型的新实例。 | 
| DbContextInfo(Type, Configuration) | 创建表示给定 DbContext 类型的新实例。 可以提供外部配置对象 (例如 app.config 或 web.config) ,并将在连接字符串解析过程中使用。 这包括查找连接字符串和 DefaultConnectionFactory 条目。 | 
| DbContextInfo(Type, ConnectionStringSettingsCollection) | 
		已过时.
	 创建表示给定 DbContext 类型的新实例。 可以提供连接字符串的外部列表,并将在连接字符串解析期间使用,以取代外部配置文件中指定的任何连接字符串。 | 
| DbContextInfo(Type, DbConnectionInfo) | 创建一个新实例,表示针对特定数据库的给定 DbContext 实例。 | 
| DbContextInfo(Type, DbProviderInfo) | 创建表示给定 DbContext 类型的新实例。 可以提供 , DbProviderInfo 以替代构造基础 EDM 模型时使用的默认确定提供程序。 | 
| DbContextInfo(Type, Configuration, DbConnectionInfo) | 创建一个表示给定 DbContext的新实例,该实例面向特定数据库。 可以提供外部配置对象 (例如 app.config 或 web.config) ,并将在连接字符串解析过程中使用。 这包括查找连接字符串和 DefaultConnectionFactory 条目。 | 
| DbContextInfo(Type, Configuration, DbProviderInfo) | 创建表示给定 DbContext 类型的新实例。 可以提供外部配置对象 (例如 app.config 或 web.config) ,并将在连接字符串解析过程中使用。 这包括查找连接字符串和 DefaultConnectionFactory 条目。 可以提供 , DbProviderInfo 以替代构造基础 EDM 模型时使用的默认确定提供程序。 这可用于防止 EF 连接以发现清单令牌。 | 
DbContextInfo(Type, Configuration)
创建表示给定 DbContext 类型的新实例。 可以提供外部配置对象 (例如 app.config 或 web.config) ,并将在连接字符串解析过程中使用。 这包括查找连接字符串和 DefaultConnectionFactory 条目。
public DbContextInfo (Type contextType, System.Configuration.Configuration config);new System.Data.Entity.Infrastructure.DbContextInfo : Type * System.Configuration.Configuration -> System.Data.Entity.Infrastructure.DbContextInfoPublic Sub New (contextType As Type, config As Configuration)参数
- config
- Configuration
表示配置文件的 对象。
适用于
DbContextInfo(Type, ConnectionStringSettingsCollection)
注意
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
创建表示给定 DbContext 类型的新实例。 可以提供连接字符串的外部列表,并将在连接字符串解析期间使用,以取代外部配置文件中指定的任何连接字符串。
[System.Obsolete("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, System.Configuration.ConnectionStringSettingsCollection connectionStringSettings);new System.Data.Entity.Infrastructure.DbContextInfo : Type * System.Configuration.ConnectionStringSettingsCollection -> System.Data.Entity.Infrastructure.DbContextInfoPublic Sub New (contextType As Type, connectionStringSettings As ConnectionStringSettingsCollection)参数
- connectionStringSettings
- ConnectionStringSettingsCollection
连接字符串的集合。
- 属性
注解
最好使用接受整个配置文档的构造函数,而不是使用此构造函数。 提供整个配置文档,除了显式指定的连接字符串外,还可以在配置中找到 DefaultConnectionFactroy 条目。
适用于
DbContextInfo(Type, DbConnectionInfo)
创建一个新实例,表示针对特定数据库的给定 DbContext 实例。
public DbContextInfo (Type contextType, System.Data.Entity.Infrastructure.DbConnectionInfo connectionInfo);new System.Data.Entity.Infrastructure.DbContextInfo : Type * System.Data.Entity.Infrastructure.DbConnectionInfo -> System.Data.Entity.Infrastructure.DbContextInfoPublic Sub New (contextType As Type, connectionInfo As DbConnectionInfo)参数
- connectionInfo
- DbConnectionInfo
要使用的数据库的连接信息。
适用于
DbContextInfo(Type, DbProviderInfo)
创建表示给定 DbContext 类型的新实例。 可以提供 , DbProviderInfo 以替代构造基础 EDM 模型时使用的默认确定提供程序。
public DbContextInfo (Type contextType, System.Data.Entity.Infrastructure.DbProviderInfo modelProviderInfo);new System.Data.Entity.Infrastructure.DbContextInfo : Type * System.Data.Entity.Infrastructure.DbProviderInfo -> System.Data.Entity.Infrastructure.DbContextInfoPublic Sub New (contextType As Type, modelProviderInfo As DbProviderInfo)参数
- modelProviderInfo
- DbProviderInfo
一个 DbProviderInfo ,指定要作为目标的基础 ADO.NET 提供程序。
适用于
DbContextInfo(Type, Configuration, DbConnectionInfo)
创建一个表示给定 DbContext的新实例,该实例面向特定数据库。 可以提供外部配置对象 (例如 app.config 或 web.config) ,并将在连接字符串解析过程中使用。 这包括查找连接字符串和 DefaultConnectionFactory 条目。
public DbContextInfo (Type contextType, System.Configuration.Configuration config, System.Data.Entity.Infrastructure.DbConnectionInfo connectionInfo);new System.Data.Entity.Infrastructure.DbContextInfo : Type * System.Configuration.Configuration * System.Data.Entity.Infrastructure.DbConnectionInfo -> System.Data.Entity.Infrastructure.DbContextInfoPublic Sub New (contextType As Type, config As Configuration, connectionInfo As DbConnectionInfo)参数
- config
- Configuration
表示配置文件的 对象。
- connectionInfo
- DbConnectionInfo
要使用的数据库的连接信息。
适用于
DbContextInfo(Type, Configuration, DbProviderInfo)
创建表示给定 DbContext 类型的新实例。 可以提供外部配置对象 (例如 app.config 或 web.config) ,并将在连接字符串解析过程中使用。 这包括查找连接字符串和 DefaultConnectionFactory 条目。 可以提供 , DbProviderInfo 以替代构造基础 EDM 模型时使用的默认确定提供程序。 这可用于防止 EF 连接以发现清单令牌。
public DbContextInfo (Type contextType, System.Configuration.Configuration config, System.Data.Entity.Infrastructure.DbProviderInfo modelProviderInfo);new System.Data.Entity.Infrastructure.DbContextInfo : Type * System.Configuration.Configuration * System.Data.Entity.Infrastructure.DbProviderInfo -> System.Data.Entity.Infrastructure.DbContextInfoPublic Sub New (contextType As Type, config As Configuration, modelProviderInfo As DbProviderInfo)参数
- config
- Configuration
表示配置文件的 对象。
- modelProviderInfo
- DbProviderInfo
一个 DbProviderInfo ,指定要作为目标的基础 ADO.NET 提供程序。