Skip to content

Commit a630a81

Browse files
carcerjeremydmiller
authored andcommitted
Include variable declarations for batch enlistment and add new endpoint hooks in validation.
1 parent 580737e commit a630a81

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/Http/Wolverine.Http.Tests/Marten/reacting_to_read_aggregate.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ await theHost.Scenario(x =>
124124

125125
public static class LetterAggregateEndpointWithValidation
126126
{
127+
public static void Before(Guid id) { }
128+
127129
public static ProblemDetails Validate(LetterAggregate letters)
128130
{
129131
if (letters.ACount is 0)
@@ -142,6 +144,8 @@ public static LetterAggregate PostLetter([WriteAggregate(Required = true, OnMiss
142144

143145
public static class LetterAggregateEndpoint
144146
{
147+
public static void Load(Guid id) { }
148+
145149
#region sample_read_aggregate_fine_grained_validation_control
146150

147151
// Straight up 404 on missing

src/Persistence/Wolverine.Marten/Codegen/MartenQueryingFrame.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,17 @@ public override IEnumerable<Variable> FindVariables(IMethodVariables chain)
107107

108108
_cancellation = chain.FindVariable(typeof(CancellationToken));
109109
yield return _cancellation;
110+
111+
// This ensures those variables are declared before we try to use them in the batch enlistment code
112+
foreach (var op in _operations)
113+
{
114+
if (op is Frame frame)
115+
{
116+
foreach (var variable in frame.FindVariables(chain))
117+
{
118+
yield return variable;
119+
}
120+
}
121+
}
110122
}
111123
}

0 commit comments

Comments
 (0)