diff --git a/src/EventSourcingTests/Bugs/document_and_event_operations_within_page.cs b/src/EventSourcingTests/Bugs/document_and_event_operations_within_page.cs index c9d5527bff..c110a60f07 100644 --- a/src/EventSourcingTests/Bugs/document_and_event_operations_within_page.cs +++ b/src/EventSourcingTests/Bugs/document_and_event_operations_within_page.cs @@ -10,11 +10,19 @@ using Marten.Storage; using Marten.Testing.Harness; using Xunit; +using Xunit.Abstractions; namespace EventSourcingTests.Bugs; public class document_and_event_operations_within_page : BugIntegrationContext { + private readonly ITestOutputHelper _output; + + public document_and_event_operations_within_page(ITestOutputHelper output) + { + _output = output; + } + [Fact] public async Task failure_due_to_ordering_change() { @@ -26,7 +34,10 @@ public async Task failure_due_to_ordering_change() theStore.Options.Projections.Add(ProjectionLifecycle.Inline); theStore.Options.Projections.Add(ProjectionLifecycle.Inline); + using var session = theStore.LightweightSession("tenant"); + session.Logger = new TestOutputMartenLogger(_output); + var mrCreated = new SamplesRolledUpCreated(Guid.NewGuid()); session.Events.StartStream(mrCreated.Id, mrCreated); await session.SaveChangesAsync(); diff --git a/src/Marten/Events/CodeGeneration/EventDocumentStorageGenerator.cs b/src/Marten/Events/CodeGeneration/EventDocumentStorageGenerator.cs index 65f64a6604..1f8a7264e8 100644 --- a/src/Marten/Events/CodeGeneration/EventDocumentStorageGenerator.cs +++ b/src/Marten/Events/CodeGeneration/EventDocumentStorageGenerator.cs @@ -141,6 +141,8 @@ private static GeneratedType buildUpdateStreamVersion(GeneratedType builderType, new TenantIdColumn().As().GenerateAppendCode(configureCommand, 3); } + configureCommand.Frames.AppendSql(" returning version"); + builderType.MethodFor(nameof(EventDocumentStorage.UpdateStreamVersion)) .Frames.Code($"return new {assembly.Namespace}.{UpdateStreamVersionOperationName}({{0}});", Use.Type());