Class TransactionalDictionary<TKey, TValue>
Wraps the changes being made to the underlying Dictionary<TKey, TValue> into a transaction.
Inherited Members
Namespace: Silverback.Util
Assembly: Silverback.Integration.dll
Syntax
public abstract class TransactionalDictionary<TKey, TValue>
Type Parameters
Name | Description |
---|---|
TKey | The type of the keys in the dictionary. |
TValue | The type of the values in the dictionary. |
Constructors
| Improve this doc View sourceTransactionalDictionary(TransactionalDictionarySharedItems<TKey, TValue>)
Initializes a new instance of the TransactionalDictionary<TKey, TValue> class.
Declaration
protected TransactionalDictionary(TransactionalDictionarySharedItems<TKey, TValue> sharedItems)
Parameters
Type | Name | Description |
---|---|---|
TransactionalDictionarySharedItems<TKey, TValue> | sharedItems | The dictionary items that are persisted and shared between the instances of this class. |
Properties
| Improve this doc View sourceCommittedItemsCount
Gets the number of items currently in the dictionary, ignoring the uncommitted changes.
Declaration
public int CommittedItemsCount { get; }
Property Value
Type | Description |
---|---|
int |
Items
Gets the underlying Dictionary<TKey, TValue> containing the persisted items.
Declaration
protected Dictionary<TKey, TValue> Items { get; }
Property Value
Type | Description |
---|---|
Dictionary<TKey, TValue> |
UncommittedItems
Gets the Dictionary<TKey, TValue> containing the pending items that will be persisted
when Commit
is called.
Declaration
protected Dictionary<TKey, TValue> UncommittedItems { get; }
Property Value
Type | Description |
---|---|
Dictionary<TKey, TValue> |
Methods
| Improve this doc View sourceAddOrReplaceAsync(TKey, TValue)
Adds or replaces an item in the dictionary.
Declaration
protected Task AddOrReplaceAsync(TKey key, TValue value)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The item key. |
TValue | value | The item value. |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
CommitAsync()
Called to commit the pending changes.
Declaration
public virtual Task CommitAsync()
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
RemoveAsync(TKey)
Removes the item with the specified key.
Declaration
protected Task RemoveAsync(TKey key)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The item key. |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
RollbackAsync()
Called to rollback the pending changes.
Declaration
public virtual Task RollbackAsync()
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |