Class SilverbackContextRelationalStorageExtensions
Adds the relational storage-specific methods to the ISilverbackContext.
Inherited Members
Namespace: Silverback.Storage
Assembly: Silverback.Storage.Relational.dll
Syntax
public static class SilverbackContextRelationalStorageExtensions
Methods
EnlistDbTransaction(ISilverbackContext, DbTransaction, bool)
Specifies the DbTransaction to be used for storage operations.
Declaration
public static IStorageTransaction EnlistDbTransaction(this ISilverbackContext context, DbTransaction transaction, bool ownTransaction = true)
Parameters
| Type | Name | Description |
|---|---|---|
| ISilverbackContext | context | The ISilverbackContext. |
| DbTransaction | transaction | The transaction. |
| bool | ownTransaction | A value indicating whether the transaction should be disposed when the IStorageTransaction is disposed. |
Returns
| Type | Description |
|---|---|
| IStorageTransaction | The IStorageTransaction. |
GetActiveDbTransaction<T>(ISilverbackContext?)
Checks whether an active DbTransaction is set and returns it.
Declaration
public static T? GetActiveDbTransaction<T>(this ISilverbackContext? context) where T : DbTransaction
Parameters
| Type | Name | Description |
|---|---|---|
| ISilverbackContext | context | The ISilverbackContext. |
Returns
| Type | Description |
|---|---|
| T | The transaction or |
Type Parameters
| Name | Description |
|---|---|
| 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.
Declaration
public static bool TryGetActiveDbTransaction<T>(this ISilverbackContext context, out T? transaction) where T : DbTransaction
Parameters
| Type | Name | Description |
|---|---|---|
| ISilverbackContext | context | The ISilverbackContext. |
| T | transaction | The transaction. |
Returns
| Type | Description |
|---|---|
| bool | A value indicating whether the transaction was found. |
Type Parameters
| Name | Description |
|---|---|
| T | The expected type of the DbTransaction. An InvalidOperationException will be thrown if the type of the stored transaction object is not compatible. |