Freigeben über


DbContext-Konstruktor

[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 eine neue Kontextinstanz unter Verwendung der Konventionen zum Erstellen des Namens der Datenbank, mit der eine Verbindung hergestellt wird. 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.Reliability", "CA2000:Dispose objects before losing scope")> _
<SuppressMessageAttribute("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")> _
Protected Sub New
'Usage
Dim instance As New DbContext()
[SuppressMessageAttribute("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
[SuppressMessageAttribute("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
protected DbContext()
[SuppressMessageAttribute(L"Microsoft.Reliability", L"CA2000:Dispose objects before losing scope")]
[SuppressMessageAttribute(L"Microsoft.Usage", L"CA2214:DoNotCallOverridableMethodsInConstructors")]
protected:
DbContext()
[<SuppressMessageAttribute("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")>]
[<SuppressMessageAttribute("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")>]
new : unit -> DbContext
protected function DbContext()

Siehe auch

Verweis

DbContext Klasse

DbContext-Überladung

System.Data.Entity-Namespace