/// <summary> /// Initializes a new instance of <see cref="EventEnvelope"/> /// </summary> /// <param name="correlationId"><see cref="TransactionCorrelationId"/> the <see cref="IEvent"/> is part of</param> /// <param name="eventId"><see cref="EventId"/> for the <see cref="IEvent"/></param> /// <param name="sequenceNumber"></param> /// <param name="sequenceNumberForEventType"></param> /// <param name="generation"><see cref="EventGeneration"/> for the <see cref="IEvent"/> </param> /// <param name="event"><see cref="Artifact"/> representing the <see cref="IEvent"/></param> /// <param name="eventSourceId"><see cref="EventSourceId"/> for the <see cref="IEventSource"/></param> /// <param name="eventSource"><see cref="Artifact"/> representing the <see cref="IEventSource"/></param> /// <param name="version"><see cref="EventSourceVersion">Version</see> of the event related to the <see cref="IEventSource"/></param> /// <param name="causedBy"><see cref="string"/> representing which person or what system caused the event</param> /// <param name="occurred"><see cref="DateTime">When</see> the event occured</param> public EventEnvelope( TransactionCorrelationId correlationId, EventId eventId, EventSequenceNumber sequenceNumber, EventSequenceNumber sequenceNumberForEventType, EventGeneration generation, Artifact @event, EventSourceId eventSourceId, Artifact eventSource, EventSourceVersion version, CausedBy causedBy, DateTimeOffset occurred) { CorrelationId = correlationId; EventId = eventId; SequenceNumber = sequenceNumber; SequenceNumberForEventType = sequenceNumberForEventType; Generation = generation; Event = @event; EventSourceId = eventSourceId; EventSource = eventSource; Version = version; CausedBy = causedBy; Occurred = occurred; }
/// <summary> /// Initializes a new instance of the <see cref="CommittedEvents"/> class. /// </summary> /// <param name="eventSourceId">The <see cref="EventSourceId"/> of the <see cref="IEventSource"/>.</param> /// <param name="committedEvents">The <see cref="CommittedEvent">events</see>.</param> public CommittedEvents(EventSourceId eventSourceId, IEnumerable <CommittedEvent> committedEvents) { EventSourceId = eventSourceId; foreach (var committedEvent in committedEvents) { EnsureEventIsValid(committedEvent); _events.Add(committedEvent); } }
/// <summary> /// Initializes a new instance of <see cref="CommittedEventStream">CommittedEventStream</see> /// </summary> /// <param name="eventSourceId">The <see cref="EventSourceId"/> of the <see cref="IEventSource"/></param> /// <param name="eventsWithEnvelope">The <see cref="IEvent">events</see> with their <see cref="EventEnvelope">envelopes</see></param> public CommittedEventStream(EventSourceId eventSourceId, IEnumerable <EventAndEnvelope> eventsWithEnvelope) { EventSourceId = eventSourceId; foreach (var eventAndEnvelope in eventsWithEnvelope) { EnsureEventIsValid(eventAndEnvelope); _events.Add(eventAndEnvelope); } }
/// <inheritdoc/> public override bool Equals(EventMetadata other) { return (Id.Equals(other.Id) && Artifact.Equals(other.Artifact) && CorrelationId.Equals(other.CorrelationId) && EventSourceId.Equals(other.EventSourceId) && Occurred.LossyEquals(other.Occurred) && OriginalContext.Equals(other.OriginalContext) && VersionedEventSource.Equals(other.VersionedEventSource)); }
/// <summary> /// Initializes a new instance of the <see cref="CommittedEvents"/> class. /// </summary> /// <param name="eventSourceId">The <see cref="EventSourceId"/> of the <see cref="IEventSource"/>.</param> public CommittedEvents(EventSourceId eventSourceId) { EventSourceId = eventSourceId; }
/// <summary> /// Initializes a new instance of the <see cref="EventBelongsToOtherEventSource"/> class. /// </summary> /// <param name="eventEventSourceId"><see cref="EventSourceId"/> for the event.</param> /// <param name="otherEventSourceId"><see cref="EventSourceId"/> for the other <see cref="IEventSource"/>.</param> public EventBelongsToOtherEventSource(EventSourceId eventEventSourceId, EventSourceId otherEventSourceId) : base($"EventSource '{eventEventSourceId}' from event mismatches with '{otherEventSourceId}'. Hint: You might be trying append an event to an UncommittedEventStream belonging to a different EventSource") { }
/// <summary> /// Instantiates a new instance of a <see cref="VersionedEventSource" /> set to the supplied version /// </summary> /// <param name="version">The <see cref="EventSourceVersion" /> of this instance</param> /// <param name="eventSource">The <see cref="EventSourceId">Id</see> for this particular <see cref="IEventSource" /></param> /// <param name="artifact">The <see cref="ArtifactId" /> that uniquely identifies the type of this event source</param> public VersionedEventSource(EventSourceVersion version, EventSourceId eventSource, ArtifactId artifact) { Version = version; EventSource = eventSource; Artifact = artifact; }
/// <summary> /// Instantiates a new instance of a <see cref="VersionedEventSource" /> set to the initial version /// </summary> /// <param name="eventSource">The <see cref="EventSourceId">Id</see> for this particular <see cref="IEventSource" /></param> /// <param name="artifact">The <see cref="ArtifactId" /> that uniquely identifies the type of this event source</param> /// <returns></returns> public VersionedEventSource(EventSourceId eventSource, ArtifactId artifact) : this(EventSourceVersion.Initial, eventSource, artifact) { }
/// <summary> /// Instantiates a new instance of an <see cref="EventSourceKey"/> with the Event Source Id and ArtifactId /// </summary> /// <param name="id">The Event Source Id</param> /// <param name="artifact">The Event Source Artifact</param> public EventSourceKey(EventSourceId id, ArtifactId artifact) { Id = id; Artifact = artifact; }
/// <summary> /// Initializes a new instance of <see cref="CommittedEventStream">CommittedEventStream</see> /// </summary> /// <param name="eventSourceId">The <see cref="EventSourceId"/> of the <see cref="IEventSource"/></param> public CommittedEventStream(EventSourceId eventSourceId) { EventSourceId = eventSourceId; }