diff --git a/src/AssociationRegistry/EventStore/EventStore.cs b/src/AssociationRegistry/EventStore/EventStore.cs index 6318f6566..692cea439 100644 --- a/src/AssociationRegistry/EventStore/EventStore.cs +++ b/src/AssociationRegistry/EventStore/EventStore.cs @@ -52,10 +52,14 @@ private static void TryLockForKboNumber(string vCode, IDocumentSession session, session.Events.StartStream(evnt.KboNummer, new { VCode = vCode }); } - private static StreamAction AppendEvents(IDocumentSession session, string aggregateId, IReadOnlyCollection events, long? expectedVersion) + private static StreamAction AppendEvents( + IDocumentSession session, + string aggregateId, + IReadOnlyCollection events, + long? expectedVersion) { if (expectedVersion is not null) - return session.Events.Append(stream: aggregateId, expectedVersion: expectedVersion.Value + events.Count, events: events); + return session.Events.Append(aggregateId, expectedVersion.Value + events.Count, events); return session.Events.Append(aggregateId, events); } @@ -64,6 +68,7 @@ private static void SetHeaders(CommandMetadata metadata, IDocumentSession sessio { session.SetHeader(MetadataHeaderNames.Initiator, metadata.Initiator); session.SetHeader(MetadataHeaderNames.Tijdstip, InstantPattern.General.Format(metadata.Tijdstip)); + session.CorrelationId = metadata.CorrelationId.ToString(); } private static bool IsEventFromDigitaalVlaanderen(Type eventType)