Class TransactionalList<T>
Wraps the changes being made to the underlying List<T> into a transaction.
Inherited Members
Namespace: Silverback.Util
Assembly: Silverback.Integration.dll
Syntax
public abstract class TransactionalList<T> where T : class
Type Parameters
Name | Description |
---|---|
T | The type of the items in the list. |
Constructors
| Improve this doc View sourceTransactionalList(TransactionalListSharedItems<T>)
Initializes a new instance of the TransactionalList<T> class.
Declaration
protected TransactionalList(TransactionalListSharedItems<T> sharedItems)
Parameters
Type | Name | Description |
---|---|---|
TransactionalListSharedItems<T> | sharedItems | The items shared between the instances of this repository. |
Properties
| Improve this doc View sourceCommittedItemsCount
Gets the number of items currently in the list, ignoring the uncommitted changes.
Declaration
public int CommittedItemsCount { get; }
Property Value
Type | Description |
---|---|
int |
Items
Gets the underlying List<T> containing the persisted items, wrapped into a TransactionalListItem<T>.
Declaration
protected IList<TransactionalListItem<T>> Items { get; }
Property Value
Type | Description |
---|---|
IList<TransactionalListItem<T>> |
UncommittedItems
Gets the List<T> containing the pending items that will be persisted when Commit
is called.
Declaration
protected IList<TransactionalListItem<T>> UncommittedItems { get; }
Property Value
Type | Description |
---|---|
IList<TransactionalListItem<T>> |
Methods
| Improve this doc View sourceAddAsync(T)
Adds the specified item to the list.
Declaration
protected Task AddAsync(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to be added. |
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(T)
Removes the specified item to the list.
Declaration
protected Task RemoveAsync(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to be added. |
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. |