RelationalDatabaseFacadeExtensions.GetDbConnection(DatabaseFacade) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the underlying ADO.NET DbConnection for this DbContext.
public static System.Data.Common.DbConnection GetDbConnection (this Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade databaseFacade);
static member GetDbConnection : Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade -> System.Data.Common.DbConnection
<Extension()>
Public Function GetDbConnection (databaseFacade As DatabaseFacade) As DbConnection
- databaseFacade
- DatabaseFacade
The DatabaseFacade for the context.
The DbConnection
This connection should not be disposed if it was created by Entity Framework. Connections are created by Entity Framework when a connection string rather than a DbConnection object is passed to the 'UseMyProvider' method for the database provider in use. Conversely, the application is responsible for disposing a DbConnection passed to Entity Framework in 'UseMyProvider'.
See Connections and connection strings for more information and examples.
Product | Versions |
---|---|
Entity Framework Core | 1.0, 1.1, 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0 |
Entity Framework feedback
Entity Framework is an open source project. Select a link to provide feedback: