Share via


IRelationalConnection Interface

Definition

Represents a connection with a relational database.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

public interface IRelationalConnection : IDisposable, Microsoft.EntityFrameworkCore.Storage.IDbContextTransactionManager, Microsoft.EntityFrameworkCore.Storage.IRelationalTransactionManager
public interface IRelationalConnection : IAsyncDisposable, IDisposable, Microsoft.EntityFrameworkCore.Storage.IDbContextTransactionManager, Microsoft.EntityFrameworkCore.Storage.IRelationalTransactionManager
type IRelationalConnection = interface
    interface IRelationalTransactionManager
    interface IDbContextTransactionManager
    interface IDisposable
type IRelationalConnection = interface
    interface IRelationalTransactionManager
    interface IDbContextTransactionManager
    interface IResettableService
    interface IDisposable
type IRelationalConnection = interface
    interface IRelationalTransactionManager
    interface IDbContextTransactionManager
    interface IResettableService
    interface IDisposable
    interface IAsyncDisposable
Public Interface IRelationalConnection
Implements IDbContextTransactionManager, IDisposable, IRelationalTransactionManager
Public Interface IRelationalConnection
Implements IAsyncDisposable, IDbContextTransactionManager, IDisposable, IRelationalTransactionManager
Derived
Implements

Remarks

The service lifetime is Scoped. This means that each DbContext instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

See Implementation of database providers and extensions for more information and examples.

Properties

ActiveCursor

Gets or sets the active cursor.

CommandTimeout

Gets the timeout for executing a command against the database.

ConnectionId

Gets the connection identifier.

ConnectionString

Gets or sets the connection string for the database.

Context

The DbContext currently in use, or null if not known.

CurrentTransaction

Gets the current transaction.

DbConnection

Gets or sets the underlying DbConnection used to connect to the database.

IsMultipleActiveResultSetsEnabled

Gets a value indicating whether the multiple active result sets feature is enabled.

Semaphore
Obsolete.

Gets a semaphore used to serialize access to this connection.

Methods

BeginTransaction()

Begins a new transaction.

(Inherited from IDbContextTransactionManager)
BeginTransaction(IsolationLevel)

Begins a new transaction.

(Inherited from IRelationalTransactionManager)
BeginTransactionAsync(CancellationToken)

Asynchronously begins a new transaction.

(Inherited from IDbContextTransactionManager)
BeginTransactionAsync(IsolationLevel, CancellationToken)

Asynchronously begins a new transaction.

(Inherited from IRelationalTransactionManager)
Close()

Closes the connection to the database.

CloseAsync()

Closes the connection to the database.

CommitTransaction()

Commits all changes made to the database in the current transaction.

(Inherited from IDbContextTransactionManager)
CommitTransactionAsync(CancellationToken)

Commits all changes made to the database in the current transaction.

(Inherited from IDbContextTransactionManager)
Open()

Opens the connection to the database.

Open(Boolean)

Opens the connection to the database.

OpenAsync(CancellationToken)

Asynchronously opens the connection to the database.

OpenAsync(CancellationToken, Boolean)

Asynchronously opens the connection to the database.

RegisterBufferable(IBufferable)

Registers a potentially bufferable active query.

RegisterBufferableAsync(IBufferable, CancellationToken)

Asynchronously registers a potentially bufferable active query.

RentCommand()

Rents a relational command that can be executed with this connection.

ResetState()

Resets the service so that it can be used from the pool.

(Inherited from IResettableService)
ResetStateAsync(CancellationToken)

Resets the service so that it can be used from the pool.

(Inherited from IResettableService)
ReturnCommand(IRelationalCommand)

Returns a relational command to this connection, so that it can be reused in the future.

RollbackTransaction()

Discards all changes made to the database in the current transaction.

(Inherited from IDbContextTransactionManager)
RollbackTransactionAsync(CancellationToken)

Discards all changes made to the database in the current transaction.

(Inherited from IDbContextTransactionManager)
SetDbConnection(DbConnection, Boolean)

Sets the underlying DbConnection used to connect to the database.

UseTransaction(DbTransaction)

Specifies an existing DbTransaction to be used for database operations.

(Inherited from IRelationalTransactionManager)
UseTransaction(DbTransaction, Guid)

Specifies an existing DbTransaction to be used for database operations.

(Inherited from IRelationalTransactionManager)
UseTransactionAsync(DbTransaction, CancellationToken)

Specifies an existing DbTransaction to be used for database operations.

(Inherited from IRelationalTransactionManager)
UseTransactionAsync(DbTransaction, Guid, CancellationToken)

Specifies an existing DbTransaction to be used for database operations.

(Inherited from IRelationalTransactionManager)

Applies to