Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Class ConnectionContext

Helper class that wraps a connection and a transaction.

Inheritance
System.Object
ConnectionContext
Namespace: EPiServer.Data.Providers.Internal
Assembly: EPiServer.Data.dll
Version: 12.0.3
Syntax
public class ConnectionContext : Object, IAsyncConnectionContext, IConnectionContext

Constructors

ConnectionContext(DbProviderFactory, ConnectionStringOptions, RetryPolicy)

Declaration
public ConnectionContext(DbProviderFactory factory, ConnectionStringOptions connectionStringOption, RetryPolicy retryPolicy)
Parameters
Type Name Description
System.Data.Common.DbProviderFactory factory
ConnectionStringOptions connectionStringOption
RetryPolicy retryPolicy

Properties

Connection

Declaration
public DbConnection Connection { get; set; }
Property Value
Type Description
System.Data.Common.DbConnection

IsActive

Determines if there is an active connection on this context

Declaration
public bool IsActive { get; }
Property Value
Type Description
System.Boolean

IsInTransaction

Declaration
public virtual bool IsInTransaction { get; }
Property Value
Type Description
System.Boolean

Transaction

Declaration
public DbTransaction Transaction { get; set; }
Property Value
Type Description
System.Data.Common.DbTransaction

Methods

BeginTransaction()

Declaration
public virtual void BeginTransaction()

CloseConnection()

Declaration
public void CloseConnection()

CommitTransaction()

Declaration
public virtual void CommitTransaction()

OpenConnection()

Open a connection to the database

Declaration
public void OpenConnection()

OpenConnectionAsync()

Declaration
public virtual Task OpenConnectionAsync()
Returns
Type Description
System.Threading.Tasks.Task

RollbackTransaction()

Declaration
public virtual void RollbackTransaction()

Implements

Extension Methods