Table of Contents

Class AsyncFactory

Namespace
LinqToDB.Async
Assembly
linq2db.dll

Provides factory methods to create async wrappers for DbConnection and DbTransaction instances.

public static class AsyncFactory
Inheritance
AsyncFactory

Methods

Create(DbConnection)

Wraps DbConnection instance into type, implementing IAsyncDbConnection.

public static IAsyncDbConnection Create(DbConnection connection)

Parameters

connection DbConnection

Connection to wrap.

Returns

IAsyncDbConnection

IAsyncDbConnection implementation for provided connection instance.

Create(DbTransaction)

Wraps DbTransaction instance into type, implementing IAsyncDbTransaction.

public static IAsyncDbTransaction Create(DbTransaction transaction)

Parameters

transaction DbTransaction

Transaction to wrap.

Returns

IAsyncDbTransaction

IAsyncDbTransaction implementation for provided transaction instance.

RegisterConnectionFactory<TConnection>(Func<DbConnection, IAsyncDbConnection>)

Register or replace custom IAsyncDbConnection for TConnection type.

public static void RegisterConnectionFactory<TConnection>(Func<DbConnection, IAsyncDbConnection> factory) where TConnection : DbConnection

Parameters

factory Func<DbConnection, IAsyncDbConnection>

IAsyncDbConnection factory.

Type Parameters

TConnection

Connection type, which should use provided factory.

RegisterTransactionFactory<TTransaction>(Func<DbTransaction, IAsyncDbTransaction>)

Register or replace custom IAsyncDbTransaction for TTransaction type.

public static void RegisterTransactionFactory<TTransaction>(Func<DbTransaction, IAsyncDbTransaction> factory) where TTransaction : DbTransaction

Parameters

factory Func<DbTransaction, IAsyncDbTransaction>

IAsyncDbTransaction factory.

Type Parameters

TTransaction

Transaction type, which should use provided factory.