Costruttore EntityConnection (MetadataWorkspace, DbConnection)
[Questa pagina è specifica della versione 6 di Entity Framework. La versione più recente è disponibile come pacchetto NuGet per "Entity Framework". Per ulteriori informazioni su Entity Framework, vedere la pagina msdn.com/data/ef.]
Inizializza una nuova istanza della classe EntityConnection con gli oggetti MetadataWorkspace e DbConnection specificati.
Spazio dei nomi: System.Data.Entity.Core.EntityClient
Assembly: EntityFramework (in EntityFramework.dll)
Sintassi
'Dichiarazione
<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 ( _
workspace As MetadataWorkspace, _
connection As DbConnection _
)
'Utilizzo
Dim workspace As MetadataWorkspace
Dim connection As DbConnection
Dim instance As New EntityConnection(workspace, _
connection)
[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(
MetadataWorkspace workspace,
DbConnection connection
)
[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(
MetadataWorkspace^ workspace,
DbConnection^ connection
)
[<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 :
workspace:MetadataWorkspace *
connection:DbConnection -> EntityConnection
public function EntityConnection(
workspace : MetadataWorkspace,
connection : DbConnection
)
Parametri
- workspace
Tipo: System.Data.Entity.Core.Metadata.Edm.MetadataWorkspace
Oggetto MetadataWorkspace da associare all'oggetto EntityConnection.
- connection
Tipo: System.Data.Common.DbConnection
Connessione all'origine dati sottostante per l'oggetto EntityConnection.
Eccezioni
Eccezione | Condizione |
---|---|
ArgumentNullException | Il parametro workspace o connection è Null. |
ArgumentException | Nell'area di lavoro manca il modello concettuale. -oppure- Nell'area di lavoro manca il file di mapping. -oppure- Nell'area di lavoro manca il modello di archiviazione. -oppure- Lo stato della connessione non è chiuso. |
ProviderIncompatibleException | Il parametro connection non proviene da un provider compatibile con ADO.NET Entity Framework. |