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
contextISilverbackContextThe ISilverbackContext.
transactionDbTransactionThe transaction.
ownTransactionboolA value indicating whether the transaction should be disposed when the IStorageTransaction is disposed.
Returns
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
contextISilverbackContextThe ISilverbackContext.
Returns
- T
The transaction or
null.
Type Parameters
TThe 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
contextISilverbackContextThe ISilverbackContext.
transactionTThe transaction.
Returns
- bool
A value indicating whether the transaction was found.
Type Parameters
TThe expected type of the DbTransaction. An InvalidOperationException will be thrown if the type of the stored transaction object is not compatible.