diff --git a/src/Marten/Events/StreamAction.cs b/src/Marten/Events/StreamAction.cs index a4c46e24c3..b7fa58113b 100644 --- a/src/Marten/Events/StreamAction.cs +++ b/src/Marten/Events/StreamAction.cs @@ -114,17 +114,11 @@ protected StreamAction(Guid id, string key, StreamActionType actionType) internal StreamAction AddEvents(IReadOnlyList 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; @@ -132,6 +126,11 @@ internal StreamAction AddEvents(IReadOnlyList events) internal StreamAction AddEvent(IEvent @event) { + if (@event.Id == Guid.Empty) + { + @event.Id = CombGuidIdGeneration.NewGuid(); + } + @event.StreamId = Id; @event.StreamKey = Key;