/// <summary> /// Initializes a new instance of the <see cref="UncommittedAggregateEvents"/> class. /// </summary> /// <param name="eventSource">The <see cref="EventSourceId"/> that the Events were applied to.</param> /// <param name="aggregateRoot">The <see cref="Artifact"/> representing the type of the Aggregate Root that applied the Event to the Event Source.</param> /// <param name="expectedAggregateRootVersion">The <see cref="AggregateRootVersion"/> of the Aggregate Root that was used to apply the rules that resulted in the Events.</param> /// <param name="events">The <see cref="UncommittedEvent">events</see>.</param> public UncommittedAggregateEvents(EventSourceId eventSource, Artifact aggregateRoot, AggregateRootVersion expectedAggregateRootVersion, IReadOnlyList <UncommittedEvent> events) : base(events) { EventSource = eventSource; AggregateRoot = aggregateRoot; ExpectedAggregateRootVersion = expectedAggregateRootVersion; }
/// <summary> /// Initializes a new instance of the <see cref="Event"/> class. /// </summary> /// <param name="eventSourceId">The Events EventSourceId.</param> /// <param name="type">The <see cref="Artifact"/> representing the type of the Event.</param> /// <param name="isPublic">Whether the Event is public.</param> /// <param name="content">The content of the Event represented as a JSON-encoded <see cref="string"/>.</param> protected Event(EventSourceId eventSourceId, Artifact type, bool isPublic, string content) { EventSource = eventSourceId; Type = type; Public = isPublic; Content = content; }
/// <summary> /// Initializes a new instance of the <see cref="CommittedEvent"/> class. /// </summary> /// <param name="eventLogSequenceNumber">The sequence number of the Event Log the Event was committed to.</param> /// <param name="occurred">The <see cref="DateTimeOffset" /> when the Event was committed to the Event Store.</param> /// <param name="eventSource">The <see cref="EventSourceId" />.</param> /// <param name="executionContext">The current <see cref="ExecutionContext" /> when this event was committed.</param> /// <param name="type">The <see cref="Artifact"/> representing the type of the Event.</param> /// <param name="isPublic">Whether this Event is public.</param> /// <param name="content">The content of the Event represented as a JSON-encoded <see cref="string"/>.</param> public CommittedEvent( EventLogSequenceNumber eventLogSequenceNumber, DateTimeOffset occurred, EventSourceId eventSource, ExecutionContext executionContext, Artifact type, bool isPublic, string content) : base(eventSource, type, isPublic, content) { EventLogSequenceNumber = eventLogSequenceNumber; Occurred = occurred; ExecutionContext = executionContext; }
/// <summary> /// Initializes a new instance of the <see cref="CommittedAggregateEvent"/> class. /// </summary> /// <param name="aggregateRoot">The aggregate root <see cref="Artifact" />.</param> /// <param name="aggregateRootVersion">The version of the aggregate root that applied the Event.</param> /// <param name="eventLogSequenceNumber">The version of the Event Log the Event was committed to.</param> /// <param name="occurred">The <see cref="DateTimeOffset" /> when the Event was committed to the Event Store.</param> /// <param name="eventSource">The Event Source that the Event was applied to.</param> /// <param name="executionContext">The <see cref="ExecutionContext" />.</param> /// <param name="type">The <see cref="Artifact"/> representing the type of the Event.</param> /// <param name="isPublic">Whether this Event is public.</param> /// <param name="content">The content of the Event represented as a JSON-encoded <see cref="string"/>.</param> public CommittedAggregateEvent( Artifact aggregateRoot, AggregateRootVersion aggregateRootVersion, EventLogSequenceNumber eventLogSequenceNumber, DateTimeOffset occurred, EventSourceId eventSource, ExecutionContext executionContext, Artifact type, bool isPublic, string content) : base(eventLogSequenceNumber, occurred, eventSource, executionContext, type, isPublic, content) { AggregateRoot = aggregateRoot; AggregateRootVersion = aggregateRootVersion; }
/// <summary> /// Initializes a new instance of the <see cref="CommittedExternalEvent"/> class. /// </summary> /// <param name="eventLogSequenceNumber">The <see cref="EventLogSequenceNumber" />.</param> /// <param name="occurred">The <see cref="DateTimeOffset" /> of when the Event was committed.</param> /// <param name="eventSource">The <see cref="EventSourceId" />.</param> /// <param name="executionContext">THe <see cref="ExecutionContext" />.</param> /// <param name="type">The <see cref="Artifact" />.</param> /// <param name="isPublic">Whether the event is public.</param> /// <param name="content">The Event content.</param> /// <param name="externalEventLogSequenceNumber">The external <see cref="EventLogSequenceNumber" />.</param> /// <param name="received">The <see cref="DateTimeOffset" /> that this external Event was received.</param> /// <param name="consent">The <see cref="Consent" />.</param> public CommittedExternalEvent( EventLogSequenceNumber eventLogSequenceNumber, DateTimeOffset occurred, EventSourceId eventSource, ExecutionContext executionContext, Artifact type, bool isPublic, string content, EventLogSequenceNumber externalEventLogSequenceNumber, DateTimeOffset received, ConsentId consent) : base(eventLogSequenceNumber, occurred, eventSource, executionContext, type, isPublic, content) { ExternalEventLogSequenceNumber = externalEventLogSequenceNumber; Received = received; Consent = consent; }
/// <summary> /// Initializes a new instance of the <see cref="CommittedAggregateEvents"/> class. /// </summary> /// <param name="eventSource">The <see cref="EventSourceId"/> that the Events were applied to.</param> /// <param name="aggregateRoot">The <see cref="ArtifactId"/> representing the type of the Aggregate Root that applied the Event to the Event Source.</param> /// <param name="events">The <see cref="CommittedAggregateEvent">events</see>.</param> public CommittedAggregateEvents(EventSourceId eventSource, ArtifactId aggregateRoot, IReadOnlyList <CommittedAggregateEvent> events) : base(events) { EventSource = eventSource; AggregateRoot = aggregateRoot; for (var i = 0; i < events.Count; i++) { if (i == 0) { _currentCheckedVersion = events[0].AggregateRootVersion; } var @event = events[i]; ThrowIfEventWasAppliedToOtherEventSource(@event); ThrowIfEventWasAppliedByOtherAggregateRoot(@event); ThrowIfAggreggateRootVersionIsOutOfOrder(@event); _currentCheckedVersion++; } }
/// <summary> /// Initializes a new instance of the <see cref="UncommittedEvent"/> class. /// </summary> /// <param name="eventSourceId">The Events EventSourceId.</param> /// <param name="type">The <see cref="Artifact"/> representing the type of the Event.</param> /// <param name="isPublic">Whether the Event is public.</param> /// <param name="content">The content of the Event represented as a JSON-encoded <see cref="string"/>.</param> public UncommittedEvent(EventSourceId eventSourceId, Artifact type, bool isPublic, string content) : base(eventSourceId, type, isPublic, content) { }
/// <summary> /// Initializes a new instance of the <see cref="EventWasAppliedToOtherEventSource"/> class. /// </summary> /// <param name="eventEventSource">The <see cref="EventSourceId"/> the Event was applied to.</param> /// <param name="eventSource"><see cref="EventSourceId"/> of the Event Source.</param> public EventWasAppliedToOtherEventSource(EventSourceId eventEventSource, EventSourceId eventSource) : base($"Event Source '{eventEventSource}' from event does not match with '{eventSource}'.") { }