Class AggregateRoot
Provides a base class for aggregate roots.
Inherited Members
Namespace: IRM.Domain
Assembly: IRM.dll
Syntax
public class AggregateRoot : Entity, IHierarchicalEntity, IEquatable<Entity>, IImplicitRemoveSupport, IAggregateRoot, IEntity, IEventSourced, ISupportMultitenant
Constructors
AggregateRoot()
Initializes a new instance of the AggregateRoot class with a ConventionEventRouter.
Declaration
protected AggregateRoot()
AggregateRoot(IRouteEvents)
Initializes a new instance of the AggregateRoot class with an event router.
Declaration
protected AggregateRoot(IRouteEvents routes)
Parameters
IRouteEvents
routes
A event router. |
Properties
IsNew
Gets if this aggregate is newly created or not.
Declaration
[IgnoreDataMember]
public virtual bool IsNew { get; }
Property Value
Boolean
true if this aggregate is new; otherwise false. |
Remarks
This only works if Version is used and loaded correctly.
OwnerId
Gets the owner of this aggregate.
Declaration
[Required]
public virtual Guid OwnerId { get; set; }
Property Value
System.Guid
|
Implements
RegisteredRoutes
Declaration
[IgnoreDataMember]
[NotMapped]
protected IRouteEvents RegisteredRoutes { get; }
Property Value
IRouteEvents
|
Version
Gets the aggregates version. As the entity is being updated and events being generated, the version is incremented.
Declaration
public virtual int Version { get; set; }
Property Value
System.Int32
|
Implements
Methods
GetSnapshot()
RaiseEvent(IEvent)
Adds an event to this aggregate event stream.
Declaration
protected virtual void RaiseEvent(IEvent event)
Parameters
IEvent
event
The IEvent to add to the event stream. |
ShouldSerializeIsNew()
Gets if the IsNew should be serialized or not. The default is false.
Declaration
public virtual bool ShouldSerializeIsNew()
Returns
Boolean
true if the IsNew should be serialized; otherwise false. |
Explicit Interface Implementations
IAggregateRoot.GetSnapshot()
IEventSourced.ClearUncommittedEvents()
Declaration
void IEventSourced.ClearUncommittedEvents()
Implements
IEventSourced.GetUncommittedEvents()
Declaration
IEnumerable<IEvent> IEventSourced.GetUncommittedEvents()
Returns
IEnumerable<IEvent>
|
Implements
IEventSourced.LoadFromEvents(IEnumerable<IEvent>)
Declaration
void IEventSourced.LoadFromEvents(IEnumerable<IEvent> events)
Parameters
IEnumerable<IEvent>
events
|