diff --git a/Directory.Packages.props b/Directory.Packages.props index 61f4a5c854..0ba91aec97 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -184,21 +184,31 @@ Also stops `Store(...)` registering `object` itself as a document type: registrability is now a SpecialType/TypeKind question, because object/string render through ToDisplayString() as C# keywords and slipped past the old name-prefix check. New JFXEVT005 (Info) flags a call - that binds to the projection's session but whose document type cannot be named. --> - - + that binds to the projection's session but whose document type cannot be named. + JasperFx 2.38.0: two changes Marten consumes directly. + jasperfx#616 (marten#5127) — the ProjectionScenario test harness is lifted into a new + JasperFx.Events.TestSupport namespace so Marten and Polecat share one implementation + instead of maintaining parallel ports. + jasperfx#617 (marten#5095) — a projection registered through AddProjectionWithServices with + a Scoped/Transient lifetime is now reachable from AggregatorFor, so live aggregation and + single stream rebuilds run the actual projection instead of silently falling through to + conventional aggregation off the aggregate type; and the projection a scoped wrapper wraps + is validated rather than only the wrapper, so an invalid configuration fails at startup for + every lifetime instead of only Singleton. --> + + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + @@ -249,7 +259,7 @@ - + - - + Weasel.Core helper so the providers cannot drift apart again. + 9.23.2 (weasel#424/#425): Sqlite and MySql implement the non-generic + Weasel.Core.ICommandBuilder (weasel#423), and the JasperFx line moves to 2.38.0 so this + matrix stays coherent with the JasperFx pins above rather than resolving transitively. --> + + diff --git a/src/EventSourcingTests/Compliance/marten_event_store_compliance.cs b/src/EventSourcingTests/Compliance/marten_event_store_compliance.cs index 7435f2b11b..d0f24b5d45 100644 --- a/src/EventSourcingTests/Compliance/marten_event_store_compliance.cs +++ b/src/EventSourcingTests/Compliance/marten_event_store_compliance.cs @@ -34,3 +34,9 @@ public class event_projection_enrichment_compliance public class rebuild_concurrency_cap_compliance : RebuildConcurrencyCapCompliance; + +public class activity_correlation_compliance + : ActivityCorrelationCompliance; + +public class string_identity_single_stream_compliance + : StringIdentitySingleStreamCompliance; diff --git a/src/Marten.Testing/Harness/ComplianceQuerySessionAlias.cs b/src/Marten.Testing/Harness/ComplianceQuerySessionAlias.cs index decec7b053..e9a290ed04 100644 --- a/src/Marten.Testing/Harness/ComplianceQuerySessionAlias.cs +++ b/src/Marten.Testing/Harness/ComplianceQuerySessionAlias.cs @@ -8,3 +8,10 @@ // they cannot reach the pair their suite class is generic over. global using ComplianceOperations = Marten.IDocumentOperations; global using ComplianceEventProjection = Marten.Events.Projections.EventProjection; + +// The string stream identity suite (JasperFx compliance wave 3) declares a custom single stream +// projection at file scope, so it cannot reach its suite class's +// generics either. Each product subclasses JasperFxSingleStreamProjectionBase under its own name, +// so the base type comes in through this alias. +global using ComplianceStringPartyProjectionBase = + Marten.Events.Aggregation.SingleStreamProjection; diff --git a/src/Marten.Testing/Harness/MartenComplianceFixture.cs b/src/Marten.Testing/Harness/MartenComplianceFixture.cs index 1ecdd07017..89f4080245 100644 --- a/src/Marten.Testing/Harness/MartenComplianceFixture.cs +++ b/src/Marten.Testing/Harness/MartenComplianceFixture.cs @@ -39,6 +39,17 @@ protected override async Task BuildStoreAsync(ComplianceStoreConfig config) options.Projections.MaxConcurrentRebuildsPerDatabase = config.MaxConcurrentRebuildsPerDatabase; } + if (config.StreamIdentity.HasValue) + { + options.Events.StreamIdentity = config.StreamIdentity.Value; + } + + if (config.EnableCorrelationTracking) + { + options.Events.MetadataConfig.CorrelationIdEnabled = true; + options.Events.MetadataConfig.CausationIdEnabled = true; + } + config.ApplyTo(new MartenComplianceRegistrar(options)); _store = new DocumentStore(options); @@ -85,6 +96,15 @@ public override Task SaveChangesAsync(IDocumentOperations session, CancellationT public override JasperFx.Events.IEventStoreOperations EventsFor(IDocumentOperations session) => session.Events; + // Session-scoped correlation/causation is shared behavior that no shared interface declares: + // in Marten the pair hangs off IQuerySession, which every session from OpenSession() is. + public override string? CorrelationIdFor(IDocumentOperations session) => ((IQuerySession)session).CorrelationId; + + public override string? CausationIdFor(IDocumentOperations session) => ((IQuerySession)session).CausationId; + + public override void SetCorrelationId(IDocumentOperations session, string? correlationId) + => ((IQuerySession)session).CorrelationId = correlationId; + public override IEventStore EventStore => _store; public override IEnumerable AllAggregateTypes() => _store.Options.Projections.AllAggregateTypes();