Share via


DbContext コンストラクター (String)

[このページは、Entity Framework 6 に関するページです。最新バージョンは、'Entity Framework' NuGet パッケージとして入手できます。Entity Framework の詳細については、msdn.com/data/ef を参照してください。]

指定された文字列を接続先のデータベースの名前または接続文字列として使用する新しいコンテキスト インスタンスを構築します。 これを使用して接続を作成する方法については、クラスの解説を参照してください。

名前空間:  System.Data.Entity
アセンブリ:  EntityFramework (EntityFramework.dll 内)

構文

'宣言
<SuppressMessageAttribute("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")> _
<SuppressMessageAttribute("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")> _
Public Sub New ( _
    nameOrConnectionString As String _
)
'使用
Dim nameOrConnectionString As String 

Dim instance As New DbContext(nameOrConnectionString)
[SuppressMessageAttribute("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
[SuppressMessageAttribute("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public DbContext(
    string nameOrConnectionString
)
[SuppressMessageAttribute(L"Microsoft.Reliability", L"CA2000:Dispose objects before losing scope")]
[SuppressMessageAttribute(L"Microsoft.Usage", L"CA2214:DoNotCallOverridableMethodsInConstructors")]
public:
DbContext(
    String^ nameOrConnectionString
)
[<SuppressMessageAttribute("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")>]
[<SuppressMessageAttribute("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")>]
new : 
        nameOrConnectionString:string -> DbContext
public function DbContext(
    nameOrConnectionString : String
)

パラメーター

  • nameOrConnectionString
    型 : System.String
    データベース名または接続文字列。

参照

参照

DbContext クラス

DbContext オーバーロード

System.Data.Entity 名前空間