Repository navigation
Dedup DCB LoadBoundaryFrame per aggregate type on a chain - #2970
mysticmind wants to merge 2 commits into
Conversation
Two [BoundaryModel] parameters of the same type on one chain (e.g. Validate plus Handle) used to each add a LoadBoundaryFrame, emitting duplicate "var eventBoundaryOf<TAggregate> = ..." declarations and failing codegen with CS0128. Modify() now reuses an existing frame for the same aggregate type. Regression test added in MartenTests/Dcb.
There was a problem hiding this comment.
Pull request overview
This PR fixes a Marten DCB code generation regression where multiple [BoundaryModel] parameters for the same aggregate type in one handler chain produced duplicate boundary loader declarations.
Changes:
- Exposes
LoadBoundaryFrame.AggregateTypefor matching existing loaders. - Reuses an existing Marten boundary loader for the same aggregate type instead of adding duplicates.
- Adds a Marten regression test covering Validate + Handle with duplicate boundary model parameters.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/Persistence/Wolverine.Marten/Codegen/LoadBoundaryFrame.cs |
Exposes aggregate type and uses it during generated boundary fetch code. |
src/Persistence/Wolverine.Marten/BoundaryModelAttribute.cs |
Adds per-chain, per-aggregate deduplication for Marten boundary loader middleware. |
src/Persistence/MartenTests/Dcb/dedup_load_boundary_frame_tests.cs |
Adds an end-to-end regression test for two [BoundaryModel] parameters on one chain. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Superseded by #2977, which keeps this dedup fix (with @mysticmind's commits retained as-authored) and adds the IL2062/IL2065/IL3050 trim suppressions on |
|
Closing in favor of #2977, which retains @mysticmind's commits and adds the trim-suppression fix for the failing CI build. |
Dedup DCB LoadBoundaryFrame per aggregate type on a chain (supersedes #2970)
Two
[BoundaryModel]parameters of the same type on one chain (e.g. Validate plus Handle) used to each add aLoadBoundaryFrame, emitting duplicatevar eventBoundaryOf<TAggregate> = ...declarations and failing codegen with CS0128. Modify() now reuses an existing frame for the same aggregate type.Regression test added in MartenTests/Dcb.