Table of Contents

Class SilverbackContextRelationalStorageExtensions

Namespace
Silverback.Storage
Assembly
Silverback.Storage.Relational.dll

Adds the relational storage-specific methods to the ISilverbackContext.

public static class SilverbackContextRelationalStorageExtensions
Inheritance
SilverbackContextRelationalStorageExtensions
Inherited Members

Methods

EnlistDbTransaction(ISilverbackContext, DbTransaction, bool)

Specifies the DbTransaction to be used for storage operations.

public static IStorageTransaction EnlistDbTransaction(this ISilverbackContext context, DbTransaction transaction, bool ownTransaction = true)

Parameters

context ISilverbackContext

The ISilverbackContext.

transaction DbTransaction

The transaction.

ownTransaction bool

A value indicating whether the transaction should be disposed when the IStorageTransaction is disposed.

Returns

IStorageTransaction

The IStorageTransaction.

GetActiveDbTransaction<T>(ISilverbackContext?)

Checks whether an active DbTransaction is set and returns it.

public static T? GetActiveDbTransaction<T>(this ISilverbackContext? context) where T : DbTransaction

Parameters

context ISilverbackContext

The ISilverbackContext.

Returns

T

The transaction or null.

Type Parameters

T

The expected type of the DbTransaction. An InvalidOperationException will be thrown if the type of the stored transaction object is not compatible.

TryGetActiveDbTransaction<T>(ISilverbackContext, out T?)

Checks whether an active DbTransaction is set and returns it.

public static bool TryGetActiveDbTransaction<T>(this ISilverbackContext context, out T? transaction) where T : DbTransaction

Parameters

context ISilverbackContext

The ISilverbackContext.

transaction T

The transaction.

Returns

bool

A value indicating whether the transaction was found.

Type Parameters

T

The expected type of the DbTransaction. An InvalidOperationException will be thrown if the type of the stored transaction object is not compatible.