Class SnapshotAggregateRoot<TAuthenticationToken, TSnapshot>
An IAggregateRoot<TAuthenticationToken> that supports Snapshot for optimised rehydration.
Inheritance
System.Object
AggregateRoot<TAuthenticationToken>
SnapshotAggregateRoot<TAuthenticationToken, TSnapshot>
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Cqrs.Snapshots
Assembly: Cqrs.dll
Syntax
public abstract class SnapshotAggregateRoot<TAuthenticationToken, TSnapshot> : AggregateRoot<TAuthenticationToken>, IAggregateRoot<TAuthenticationToken> where TSnapshot : Snapshot
Type Parameters
Name | Description |
---|---|
TAuthenticationToken | |
TSnapshot |
Methods
CreateSnapshot()
Create a TSnapshot
of the current state of this instance.
Declaration
protected abstract TSnapshot CreateSnapshot()
Returns
Type | Description |
---|---|
TSnapshot |
GetSnapshot()
Calls CreateSnapshot() and applies the Id of this instance to the TSnapshot
result.
Declaration
public virtual TSnapshot GetSnapshot()
Returns
Type | Description |
---|---|
TSnapshot |
Restore(TSnapshot)
Sets the Id of this instance from Id the provided snapshot
,
sets the Version of this instance from Version the provided snapshot
,
then calls RestoreFromSnapshot(TSnapshot)
Declaration
public virtual void Restore(TSnapshot snapshot)
Parameters
Type | Name | Description |
---|---|---|
TSnapshot | snapshot | The |
RestoreFromSnapshot(TSnapshot)
Rehydrate this instance from the provided snapshot
.
Declaration
protected abstract void RestoreFromSnapshot(TSnapshot snapshot)
Parameters
Type | Name | Description |
---|---|---|
TSnapshot | snapshot | The |