-
-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated JasperFx.CodeGeneration for a fix to tuples with more than on…
…e of the same type. Addresses issue with multiple side effects in same tuple. Closes GH-778
- Loading branch information
1 parent
01a8bca
commit 66750b4
Showing
2 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
src/Persistence/MartenTests/Bugs/Bug_778_multiple_marten_ops_in_tuple.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using IntegrationTests; | ||
using Marten; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using Shouldly; | ||
using Wolverine; | ||
using Wolverine.Marten; | ||
using Wolverine.Runtime.Interop.MassTransit; | ||
using Wolverine.Tracking; | ||
|
||
namespace MartenTests.Bugs; | ||
|
||
public class Bug_778_multiple_marten_ops_in_tuple : PostgresqlContext | ||
{ | ||
[Fact] | ||
public async Task call_both_side_effects() | ||
{ | ||
using var host = await Host.CreateDefaultBuilder() | ||
.UseWolverine(opts => | ||
{ | ||
opts.Discovery.DisableConventionalDiscovery().IncludeType(typeof(SpawnHandler)); | ||
|
||
opts.Services.AddMarten(m => | ||
{ | ||
m.Connection(Servers.PostgresConnectionString); | ||
m.DatabaseSchemaName = "side_effects"; | ||
}).IntegrateWithWolverine(); | ||
|
||
opts.Policies.AutoApplyTransactions(); | ||
}).StartAsync(); | ||
|
||
var command = new SpawnTwo(Guid.NewGuid().ToString(), Guid.NewGuid().ToString()); | ||
|
||
await host.InvokeMessageAndWaitAsync(command); | ||
|
||
var store = host.Services.GetRequiredService<IDocumentStore>(); | ||
using var session = store.LightweightSession(); | ||
var person1 = await session.LoadAsync<Person>(command.Name1); | ||
var person2 = await session.LoadAsync<Person>(command.Name2); | ||
|
||
person1.ShouldNotBeNull(); | ||
person2.ShouldNotBeNull(); | ||
|
||
|
||
} | ||
} | ||
|
||
public static class SpawnHandler | ||
{ | ||
public static (IMartenOp, IMartenOp) Handle(SpawnTwo command) | ||
=> (MartenOps.Store(new Person(command.Name1)), MartenOps.Store(new Person(command.Name2))); | ||
} | ||
|
||
public record SpawnTwo(string Name1, string Name2); | ||
|
||
public record Person(string Id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters