Class AkkaAggregateRoot<TAuthenticationToken>
An IAggregateRoot<TAuthenticationToken> that is safe to use within Akka.NET
Inheritance
Inherited Members
Namespace: Cqrs.Akka.Domain
Assembly: Cqrs.Akka.dll
Syntax
public abstract class AkkaAggregateRoot<TAuthenticationToken> : ReceiveActor, IInternalActor, IInitializableActor, IAggregateRoot<TAuthenticationToken>
Type Parameters
Name | Description |
---|---|
TAuthenticationToken | The System.Type of authentication token. |
Constructors
AkkaAggregateRoot(IUnitOfWork<TAuthenticationToken>, ILogger, IAkkaAggregateRepository<TAuthenticationToken>, ICorrelationIdHelper, IAuthenticationTokenHelper<TAuthenticationToken>)
Instantiates a new instance of AkkaAggregateRoot<TAuthenticationToken>
Declaration
protected AkkaAggregateRoot(IUnitOfWork<TAuthenticationToken> unitOfWork, ILogger logger, IAkkaAggregateRepository<TAuthenticationToken> repository, ICorrelationIdHelper correlationIdHelper, IAuthenticationTokenHelper<TAuthenticationToken> authenticationTokenHelper)
Parameters
Type | Name | Description |
---|---|---|
IUnitOfWork<TAuthenticationToken> | unitOfWork | |
cdmdotnet.Logging.ILogger | logger | |
IAkkaAggregateRepository<TAuthenticationToken> | repository | |
cdmdotnet.Logging.ICorrelationIdHelper | correlationIdHelper | |
IAuthenticationTokenHelper<TAuthenticationToken> | authenticationTokenHelper |
Properties
AuthenticationTokenHelper
Gets or sets the IAuthenticationTokenHelper<TAuthenticationToken>.
Declaration
protected IAuthenticationTokenHelper<TAuthenticationToken> AuthenticationTokenHelper { get; set; }
Property Value
Type | Description |
---|---|
IAuthenticationTokenHelper<TAuthenticationToken> |
CorrelationIdHelper
Gets or sets the cdmdotnet.Logging.ICorrelationIdHelper.
Declaration
protected ICorrelationIdHelper CorrelationIdHelper { get; set; }
Property Value
Type | Description |
---|---|
cdmdotnet.Logging.ICorrelationIdHelper |
Id
The identifier of this IAggregateRoot<TAuthenticationToken>.
Declaration
public Guid Id { get; protected set; }
Property Value
Type | Description |
---|---|
System.Guid |
Implements
Logger
Gets or sets the cdmdotnet.Logging.ILogger.
Declaration
protected ILogger Logger { get; set; }
Property Value
Type | Description |
---|---|
cdmdotnet.Logging.ILogger |
Repository
Gets or sets the IAkkaAggregateRepository<TAuthenticationToken>.
Declaration
protected IAkkaAggregateRepository<TAuthenticationToken> Repository { get; set; }
Property Value
Type | Description |
---|---|
IAkkaAggregateRepository<TAuthenticationToken> |
UnitOfWork
Gets or sets the IUnitOfWork<TAuthenticationToken>.
Declaration
protected IUnitOfWork<TAuthenticationToken> UnitOfWork { get; set; }
Property Value
Type | Description |
---|---|
IUnitOfWork<TAuthenticationToken> |
Version
The current version of this IAggregateRoot<TAuthenticationToken>.
Declaration
public int Version { get; protected set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Implements
Methods
ApplyChange(IEvent<TAuthenticationToken>)
Call the "Apply" method with a signature matching the provided event
without using event replay to this instance.
Declaration
protected virtual void ApplyChange(IEvent<TAuthenticationToken> event)
Parameters
Type | Name | Description |
---|---|---|
IEvent<TAuthenticationToken> | event |
Remarks
This means a method named "Apply", with return type void and one parameter must exist to be applied.
If no method exists, nothing is applied
The parameter type must match exactly the System.Type of the provided event
.
Execute<TCommand>(Action<TCommand>, TCommand)
Executes the provided action
passing it the provided command
,
then calls PublishEvent(IEvent<TAuthenticationToken>)
Declaration
protected virtual void Execute<TCommand>(Action<TCommand> action, TCommand command)where TCommand : ICommand<TAuthenticationToken>
Parameters
Type | Name | Description |
---|---|---|
System.Action<TCommand> | action | |
TCommand | command |
Type Parameters
Name | Description |
---|---|
TCommand |
GetUncommittedChanges()
Get all applied changes that haven't yet been committed.
Declaration
public IEnumerable<IEvent<TAuthenticationToken>> GetUncommittedChanges()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IEvent<TAuthenticationToken>> |
Implements
LoadFromHistory(IEnumerable<IEvent<TAuthenticationToken>>)
Apply all the IEvent<TAuthenticationToken> in history
using event replay to this instance.
Declaration
public virtual void LoadFromHistory(IEnumerable<IEvent<TAuthenticationToken>> history)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<IEvent<TAuthenticationToken>> | history |
Implements
MarkChangesAsCommitted()
Mark all applied changes as committed, increment Version and flush the internal collection of changes.
Declaration
public virtual void MarkChangesAsCommitted()
Implements
PreStart()
User overridable callback.
Is called when an Actor is started. Actors are automatically started asynchronously when created. Empty default implementation.
Declaration
protected override void PreStart()