Table of Contents

Interface IDataSession

Namespace
FluentCommand
Assembly
FluentCommand.dll

An interface for data sessions.

public interface IDataSession : IDisposable, IAsyncDisposable
Inherited Members
Extension Methods

Properties

Cache

Gets the underlying IDataCache for the session.

IDataCache Cache { get; }

Property Value

IDataCache

Connection

Gets the underlying DbConnection for the session.

DbConnection Connection { get; }

Property Value

DbConnection

QueryGenerator

Gets the query generator provider.

IQueryGenerator QueryGenerator { get; }

Property Value

IQueryGenerator

The query generator provider.

QueryLogger

Gets the data command query logger.

IDataQueryLogger QueryLogger { get; }

Property Value

IDataQueryLogger

The data command query logger.

Transaction

Gets the underlying DbTransaction for the session.

DbTransaction Transaction { get; }

Property Value

DbTransaction

Methods

BeginTransaction(IsolationLevel)

Starts a database transaction with the specified isolation level.

DbTransaction BeginTransaction(IsolationLevel isolationLevel)

Parameters

isolationLevel IsolationLevel

Specifies the isolation level for the transaction.

Returns

DbTransaction

A DbTransaction representing the new transaction.

BeginTransactionAsync(IsolationLevel, CancellationToken)

Starts a database transaction with the specified isolation level.

Task<DbTransaction> BeginTransactionAsync(IsolationLevel isolationLevel = IsolationLevel.Unspecified, CancellationToken cancellationToken = default)

Parameters

isolationLevel IsolationLevel

Specifies the isolation level for the transaction.

cancellationToken CancellationToken

The cancellation instruction.

Returns

Task<DbTransaction>

A DbTransaction representing the new transaction.

EnsureConnection()

Ensures the connection is open.

void EnsureConnection()

EnsureConnectionAsync(CancellationToken)

Ensures the connection is open asynchronous.

Task EnsureConnectionAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

The cancellation instruction.

Returns

Task

A task representing the asynchronous operation.

Exceptions

InvalidOperationException

Failed to open connection

ReleaseConnection()

Releases the connection.

void ReleaseConnection()

ReleaseConnectionAsync()

Releases the connection.

Task ReleaseConnectionAsync()

Returns

Task

Sql(string)

Starts a data command with the specified SQL.

IDataCommand Sql(string sql)

Parameters

sql string

The SQL statement.

Returns

IDataCommand

A fluent interface to a data command.

StoredProcedure(string)

Starts a data command with the specified stored procedure name.

IDataCommand StoredProcedure(string storedProcedureName)

Parameters

storedProcedureName string

Name of the stored procedure.

Returns

IDataCommand

A fluent interface to a data command.