共用方式為


EntityConnection 建構函式 (String)

[此頁面專屬於 Entity Framework 第 6 版。最新版本可從 'Entity Framework' NuGet 套件取得。如需 Entity Framework 的詳細資訊,請參閱 msdn.com/data/ef。]

根據連接字串初始化 EntityConnection 類別的新執行個體。

命名空間:  System.Data.Entity.Core.EntityClient
組件:  EntityFramework (在 EntityFramework.dll 中)

語法

'宣告
<SuppressMessageAttribute("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")> _
<SuppressMessageAttribute("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope", Justification := "Object is in fact passed to property of the class and gets Disposed properly in the Dispose() method.")> _
Public Sub New ( _
    connectionString As String _
)
'用途
Dim connectionString As String 

Dim instance As New EntityConnection(connectionString)
[SuppressMessageAttribute("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
[SuppressMessageAttribute("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope", Justification = "Object is in fact passed to property of the class and gets Disposed properly in the Dispose() method.")]
public EntityConnection(
    string connectionString
)
[SuppressMessageAttribute(L"Microsoft.Usage", L"CA2214:DoNotCallOverridableMethodsInConstructors")]
[SuppressMessageAttribute(L"Microsoft.Reliability", L"CA2000:DisposeObjectsBeforeLosingScope", Justification = L"Object is in fact passed to property of the class and gets Disposed properly in the Dispose() method.")]
public:
EntityConnection(
    String^ connectionString
)
[<SuppressMessageAttribute("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")>]
[<SuppressMessageAttribute("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope", Justification = "Object is in fact passed to property of the class and gets Disposed properly in the Dispose() method.")>]
new : 
        connectionString:string -> EntityConnection
public function EntityConnection(
    connectionString : String
)

參數

  • connectionString
    類型:System.String
    提供者特定連接字串。

例外狀況

例外狀況 條件
ArgumentException

已提供無效的連接字串關鍵字,或尚未提供必要的連接字串關鍵字。

請參閱

參考

EntityConnection 類別

EntityConnection 多載

System.Data.Entity.Core.EntityClient 命名空間