Freigeben über


DbContext-Konstruktor (DbCompiledModel)

[Diese Seite bezieht sich auf Entity Framework Version 6. Die neueste Version ist als 'Entity Framework' NuGet-Paket verfügbar. Weitere Informationen zu Entity Framework finden Sie unter msdn.com/data/ef.]

Erstellt mit Konventionen zum Erstellen des Namens der Datenbank, mit der eine Verbindung hergestellt wird, eine neue Kontextinstanz und initialisiert sie anhand des angegebenen Modells. Konventionsgemäß ist der Name der vollständige Name (Namespacename + Klassenname) der abgeleiteten Kontextklasse. Siehe Klassenhinweise zur Erstellung einer Verbindung.

Namespace:  System.Data.Entity
Assembly:  EntityFramework (in EntityFramework.dll)

Syntax

'Declaration
<SuppressMessageAttribute("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")> _
<SuppressMessageAttribute("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")> _
Protected Sub New ( _
    model As DbCompiledModel _
)
'Usage
Dim model As DbCompiledModel 

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

Parameter

Siehe auch

Verweis

DbContext Klasse

DbContext-Überladung

System.Data.Entity-Namespace