Skip to content

Commit

Permalink
Make sure StreamAction.AddEvent also sets the event ID, just as AddEv…
Browse files Browse the repository at this point in the history
…ents already does

This fixes #3533.
  • Loading branch information
haefele authored and jeremydmiller committed Nov 3, 2024
1 parent d9c28fa commit 20c1ce5
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/Marten/Events/StreamAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,24 +114,23 @@ protected StreamAction(Guid id, string key, StreamActionType actionType)

internal StreamAction AddEvents(IReadOnlyList<IEvent> events)
{
_events.AddRange(events);
_events.EnsureCapacity(_events.Count + events.Count);

foreach (var @event in events)
{
if (@event.Id == Guid.Empty)
{
@event.Id = CombGuidIdGeneration.NewGuid();
}

@event.StreamId = Id;
@event.StreamKey = Key;
AddEvent(@event);
}

return this;
}

internal StreamAction AddEvent(IEvent @event)
{
if (@event.Id == Guid.Empty)
{
@event.Id = CombGuidIdGeneration.NewGuid();
}

@event.StreamId = Id;
@event.StreamKey = Key;

Expand Down

0 comments on commit 20c1ce5

Please sign in to comment.