![]() |
CQRS.NET
4.0
A lightweight enterprise Function as a Service (FaaS) framework to write function based serverless and micro-service applications in hybrid multi-datacentre, on-premise and Azure environments.
|
A larger unit of encapsulation than just a class. Every transaction is scoped to a single aggregate. The lifetimes of the components of an aggregate are bounded by the lifetime of the entire aggregate. More...
Public Member Functions | |
IEnumerable< IEvent< TAuthenticationToken > > | GetUncommittedChanges () |
Get all applied changes that haven't yet been committed. More... | |
virtual void | MarkChangesAsCommitted () |
Mark all applied changes as committed, increment Version and flush the internal collection of changes. More... | |
virtual void | LoadFromHistory (IEnumerable< IEvent< TAuthenticationToken >> history) |
Apply all the events in history using event replay to this instance. More... | |
Protected Member Functions | |
AggregateRoot () | |
Instantiates a new instance of AggregateRoot<TAuthenticationToken>. More... | |
virtual void | Initialise () |
Initialise any properties More... | |
virtual void | ApplyChange (IEvent< TAuthenticationToken > @event) |
Call the "Apply" method with a signature matching the provided event without using event replay to this instance. More... | |
virtual void | ApplyChanges (IEnumerable< IEvent< TAuthenticationToken >> events) |
Call the "Apply" method with a signature matching each IEvent<TAuthenticationToken> in the provided events without using event replay to this instance. More... | |
Properties | |
Guid | Id [get, protected set] |
The identifier of this IAggregateRoot<TAuthenticationToken>. More... | |
int | Version [get, protected set] |
The current version of this IAggregateRoot<TAuthenticationToken>. More... | |
![]() | |
Guid | Id [get] |
The identifier of this IAggregateRoot<TAuthenticationToken>. More... | |
int | Version [get] |
The current version of this IAggregateRoot<TAuthenticationToken>. More... | |
A larger unit of encapsulation than just a class. Every transaction is scoped to a single aggregate. The lifetimes of the components of an aggregate are bounded by the lifetime of the entire aggregate.
Concretely, an aggregate will handle commands, apply events, and have a state model encapsulated within it that allows it to implement the required command validation, thus upholding the invariants (business rules) of the aggregate.
Why is the use of GUID as IDs a good practice?
Because they are (reasonably) globally unique, and can be generated either by the server or by the client.