Show / Hide Table of Contents

Class AggregateRoot

Provides a base class for aggregate roots.

Inheritance
Object
Entity
AggregateRoot
Inherited Members
Entity.Id
Entity.AggregateRoot
Entity.IHierarchicalEntity.AggregateRoot
Entity.SetSomÄndrad(DateTime, String)
Entity.IEntity.SetSomÄndrad(DateTime, String)
Entity.SenastÄndradAv
Entity.SenastÄndrad
Entity.SkapadAv
Entity.Skapad
Entity.GetHashCode()
Entity.Equals(Entity)
Entity.Equals(Object)
Entity.IImplicitRemoveSupport.IsRemoved
System.Object.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
Object.MemberwiseClone()
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
IAggregateRoot.OwnerId
ISupportMultitenant.OwnerId

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
IEventSourced.Version

Methods

GetSnapshot()

Declaration
protected virtual IMemento GetSnapshot()
Returns
IMemento

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()

Declaration
IMemento IAggregateRoot.GetSnapshot()
Returns
IMemento

Implements
IAggregateRoot.GetSnapshot()

IEventSourced.ClearUncommittedEvents()

Declaration
void IEventSourced.ClearUncommittedEvents()
Implements
IEventSourced.ClearUncommittedEvents()

IEventSourced.GetUncommittedEvents()

Declaration
IEnumerable<IEvent> IEventSourced.GetUncommittedEvents()
Returns
IEnumerable<IEvent>

Implements
IEventSourced.GetUncommittedEvents()

IEventSourced.LoadFromEvents(IEnumerable<IEvent>)

Declaration
void IEventSourced.LoadFromEvents(IEnumerable<IEvent> events)
Parameters
IEnumerable<IEvent> events

Implements
IEventSourced.LoadFromEvents(IEnumerable<IEvent>)

Extension Methods

ObjectExtensions.DeepClone<T>(T)
AnnotationsExtensions.IsValid(Object)
EventExtensions.HasProducedEvent<T>(IEventSourced)
EventExtensions.CountOfProducedEventsIs(IEventSourced, Int32)
EventExtensions.GetProducedEvents(IEventSourced)
Back to top Generated by DocFX