Class ChangeRepository
Saves and gets aggregates to and from an change store.
public class ChangeRepository : IChangeRepository
- Inheritance
-
ChangeRepository
- Implements
- Inherited Members
- Extension Methods
Constructors
ChangeRepository(IChangeStore)
public ChangeRepository(IChangeStore store)
Parameters
storeIChangeStore
Methods
Box<T>(T)
Copies an aggregate to offline storage and removes it from online logs.
public void Box<T>(T aggregate) where T : AggregateRoot
Parameters
aggregateT
Type Parameters
T
Remarks
Aggregate boxing/unboxing is not implemented by default for all aggregates. It must be explicitly implemented per aggregate for those aggregates that require this functionality, and snapshots are required. Therefore this function in this class throws a NotImplementedException; refer to SnapshotRepository for the implementation.
Exists<T>(Guid)
Returns true if an aggregate exists.
public bool Exists<T>(Guid aggregate)
Parameters
aggregateGuid
Returns
Type Parameters
T
GetClone<T>(Guid, int?)
public T GetClone<T>(Guid aggregateId, int? version = -1) where T : AggregateRoot
Parameters
Returns
- T
Type Parameters
T
Get<T>(Guid, int?)
Gets an aggregate from the change store.
public T Get<T>(Guid aggregate, int? expectedVersion = -1) where T : AggregateRoot
Parameters
Returns
- T
Type Parameters
T
LockAndRun<T>(Guid, Action<T>)
public void LockAndRun<T>(Guid aggregateId, Action<T> action) where T : AggregateRoot
Parameters
Type Parameters
T
Peek<T>(Guid, int)
Returns a specific aggregate as at a specific version.
public T Peek<T>(Guid aggregate, int asAtVersion) where T : AggregateRoot
Parameters
Returns
- T
Type Parameters
T
Save<T>(T, int?)
Saves all uncommitted changes to the change store.
public IChange[] Save<T>(T aggregate, int? expectedVersion) where T : AggregateRoot
Parameters
aggregateTexpectedVersionint?
Returns
- IChange[]
Type Parameters
T
Unbox<T>(Guid)
Retrieves an aggregate from offline storage and returns only its most recent state.
public T Unbox<T>(Guid aggregateId) where T : AggregateRoot
Parameters
aggregateIdGuid
Returns
- T
Type Parameters
T
Remarks
Aggregate boxing/unboxing is not implemented by default for all aggregates. It must be explicitly implemented per aggregate for those aggregates that require this functionality, and snapshots are required. Therefore this function in this class throws a NotImplementedException; refer to SnapshotRepository for the implementation.