Table of Contents

Interface IChangeStore

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

Defines the methods needed from the change store.

public interface IChangeStore
Extension Methods

Methods

Box(Guid, bool)

Copies an aggregate to offline storage and removes it from online logs.

void Box(Guid aggregate, bool archive)

Parameters

aggregate Guid
archive bool

Remarks

Someone who is a purist with regard to change sourcing will red-flag this function and say the change stream for an aggregate should never be altered or removed. However, we have two scenarios in which this is a non- negotiable business requirement. First, when a customer does not renew their contract with our business, we have a contractual obligation to remove all the customer's data from our systems. Second, we frequently run test-cases to confirm system functions are operating correctly; this data is temporary by definition, and we do not want to permanently store the change streams for test aggregates.

Count(Guid, int)

Gets count of changes for an aggregate.

int Count(Guid aggregate, int fromVersion = -1)

Parameters

aggregate Guid
fromVersion int

Returns

int

Count(Guid, string, bool)

Used by ChangeGrid

int Count(Guid aggregate, string keyword, bool includeChildren)

Parameters

aggregate Guid
keyword string
includeChildren bool

Returns

int

Count(string, IEnumerable<Guid>)

Gets count of changes for an aggregate.

int Count(string aggregateType, IEnumerable<Guid> aggregateIdentifiers)

Parameters

aggregateType string
aggregateIdentifiers IEnumerable<Guid>

Returns

int

Exists(Guid, int)

Returns true if an aggregate with a specific version exists.

bool Exists(Guid aggregate, int version)

Parameters

aggregate Guid
version int

Returns

bool

Exists<T>(Guid)

Returns true if an aggregate exists.

bool Exists<T>(Guid aggregate)

Parameters

aggregate Guid

Returns

bool

Type Parameters

T

GetAggregates(string)

Gets all the identifiers for a specific aggregate type.

List<Guid> GetAggregates(string aggregateType)

Parameters

aggregateType string

Returns

List<Guid>

GetChange(Guid, int)

Gets a specific version of change for an aggregate.

IChange GetChange(Guid aggregate, int version)

Parameters

aggregate Guid
version int

Returns

IChange

GetChanges(Guid, int)

Gets changes for an aggregate starting at a specific version. To get all changes use version = -1.

IChange[] GetChanges(Guid aggregate, int fromVersion)

Parameters

aggregate Guid
fromVersion int

Returns

IChange[]

GetChanges(Guid, int, int)

Gets changes for an aggregate within a specific range of versions.

IChange[] GetChanges(Guid aggregate, int fromVersion, int toVersion)

Parameters

aggregate Guid
fromVersion int
toVersion int

Returns

IChange[]

GetChanges(string, IEnumerable<Guid>)

Enumerate changes for all aggregates of a specific type.

List<IChange> GetChanges(string aggregateType, IEnumerable<Guid> aggregateIdentifiers)

Parameters

aggregateType string
aggregateIdentifiers IEnumerable<Guid>

Returns

List<IChange>

GetChanges(string, Guid?, IEnumerable<string>)

Gets changes for all aggregates of a specific type.

IChange[] GetChanges(string aggregateType, Guid? id, IEnumerable<string> changeTypes)

Parameters

aggregateType string
id Guid?
changeTypes IEnumerable<string>

Returns

IChange[]

GetChangesPaged(Guid, string, bool, int, int)

Used in ChangeGrid

IChange[] GetChangesPaged(Guid aggregate, string keyword, bool includeChildren, int skip, int pageSize)

Parameters

aggregate Guid
keyword string
includeChildren bool
skip int
pageSize int

Returns

IChange[]

GetClassAndOrganization(Guid, out string, out Guid)

void GetClassAndOrganization(Guid aggregate, out string @class, out Guid organization)

Parameters

aggregate Guid
class string
organization Guid

GetExpired(DateTimeOffset)

Gets all aggregates that are scheduled to expire at (or before) a specific time on a specific date.

Guid[] GetExpired(DateTimeOffset at)

Parameters

at DateTimeOffset

Returns

Guid[]

GetSerializedChangesPaged(Guid, string, bool, int, int)

Gets serialized changes for all aggregates of a specific type.

List<SerializedChange> GetSerializedChangesPaged(Guid aggregate, string keyword, bool includeChildren, int skip, int pageSize)

Parameters

aggregate Guid
keyword string
includeChildren bool
skip int
pageSize int

Returns

List<SerializedChange>

Insert(IChange, int)

Insert change into the stream at a specific position.

void Insert(IChange change, int index)

Parameters

change IChange
index int

Remarks

Aggregate change streams index from starting position 1 (not 0).

RegisterObsoleteChangeTypes(IEnumerable<string>)

Allows to mark a change as an obsolete ChangeStore doesn't try to deserialize an obsolete change and returns the change as SerializedChange This is useful when a specific change is obsolete and we need either ignore it or transform to a new change

void RegisterObsoleteChangeTypes(IEnumerable<string> changeTypes)

Parameters

changeTypes IEnumerable<string>

Rollback(Guid, int)

Performs a rollback on a specific aggregate to a specific version number. In simplest terms, this method deletes all the changes in an aggregate where the version number is greater than or equal to the input parameter.

int Rollback(Guid id, int version)

Parameters

id Guid
version int

Returns

int

Save(AggregateRoot, IEnumerable<IChange>)

Save changes.

void Save(AggregateRoot aggregate, IEnumerable<IChange> changes)

Parameters

aggregate AggregateRoot
changes IEnumerable<IChange>

Save(IChange)

Save change.

void Save(IChange change)

Parameters

change IChange

Save(IEnumerable<AggregateImport>)

void Save(IEnumerable<AggregateImport> import)

Parameters

import IEnumerable<AggregateImport>

Unbox(Guid, Func<Guid, AggregateRoot>)

void Unbox(Guid aggregate, Func<Guid, AggregateRoot> creator)

Parameters

aggregate Guid
creator Func<Guid, AggregateRoot>