Table of Contents

Class ChangeRepository

Namespace
Shift.Common.Timeline.Changes
Assembly
Shift.Common.dll

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

store IChangeStore

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

aggregate 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.

Exists<T>(Guid)

Returns true if an aggregate exists.

public bool Exists<T>(Guid aggregate)

Parameters

aggregate Guid

Returns

bool

Type Parameters

T

GetClone<T>(Guid, int?)

public T GetClone<T>(Guid aggregateId, int? version = -1) where T : AggregateRoot

Parameters

aggregateId Guid
version int?

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

aggregate Guid
expectedVersion int?

Returns

T

Type Parameters

T

LockAndRun<T>(Guid, Action<T>)

public void LockAndRun<T>(Guid aggregateId, Action<T> action) where T : AggregateRoot

Parameters

aggregateId Guid
action Action<T>

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

aggregate Guid
asAtVersion int

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

aggregate T
expectedVersion int?

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

aggregateId Guid

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.