/// <inheritdoc/> public EventSourceVersion GetFor(IApplicationResourceIdentifier eventSource, EventSourceId eventSourceId) { var version = EventSourceVersion.Zero; version = _eventStore.GetVersionFor(eventSource, eventSourceId); return(version); }
/// <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="IApplicationResourceIdentifier"/> representing the <see cref="IEvent"/></param> /// <param name="eventSourceId"><see cref="EventSourceId"/> for the <see cref="IEventSource"/></param> /// <param name="eventSource"><see cref="IApplicationResourceIdentifier"/> 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, IApplicationResourceIdentifier @event, EventSourceId eventSourceId, IApplicationResourceIdentifier 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 <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); } }
/// <summary> /// Initializes a new instance of <see cref="EventBelongsToOtherEventSource"/> /// </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") { }
/// <inheritdoc/> public EventSourceVersion GetVersionFor(IApplicationResourceIdentifier eventSource, EventSourceId eventSourceId) { return(EventSourceVersion.Zero); }
/// <inheritdoc/> public bool HasEventsFor(IApplicationResourceIdentifier eventSource, EventSourceId eventSourceId) { return(false); }
/// <inheritdoc/> public IEnumerable <EventAndEnvelope> GetFor(IApplicationResourceIdentifier eventSource, EventSourceId eventSourceId) { return(new EventAndEnvelope[0]); }
/// <inheritdoc/> public void SetFor(IApplicationResourceIdentifier eventSource, EventSourceId eventSourceId, EventSourceVersion version) { }
/// <summary> /// Initializes an instance of <see cref="EventSource">EventSource</see> /// </summary> /// <param name="id"><see cref="Events.EventSourceId"/> of the event source</param> protected EventSource(EventSourceId id) { EventSourceId = id; UncommittedEvents = new UncommittedEventStream(this); }
/// <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; }
/// <summary> /// Initializes a new instance of <see cref="Event">Event</see> /// </summary> protected Event(EventSourceId eventSourceId) { EventSourceId = eventSourceId; }