DbContextInfo 建構函式 (Type, ConnectionStringSettingsCollection)
[此頁面專屬於 Entity Framework 第 6 版。最新版本可從 'Entity Framework' NuGet 套件取得。如需 Entity Framework 的詳細資訊,請參閱 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
)
參數
- contextType
類型:System.Type
衍生自 DbContext 的類型。
- connectionStringSettings
類型:System.Configuration.ConnectionStringSettingsCollection
連接字串的集合。
備註
最好是使用可接受完整組態文件的建構函式,而不要使用此建構函式。 除了明確指定的連接字串之外,提供完整組態文件還可在組態中找到 DefaultConnectionFactroy 項目。