Skip to content

Commit

Permalink
Updated JasperFx.CodeGeneration for a fix to tuples with more than on…
Browse files Browse the repository at this point in the history
…e of the same type. Addresses issue with multiple side effects in same tuple. Closes GH-778
  • Loading branch information
jeremydmiller committed Mar 21, 2024
1 parent 01a8bca commit 66750b4
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
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);
4 changes: 2 additions & 2 deletions src/Wolverine/Wolverine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="7.0.0" />
<PackageReference Include="System.ComponentModel" Version="4.3.0" />
<PackageReference Include="JasperFx.CodeGeneration.Commands" Version="3.5.0" />
<PackageReference Include="JasperFx.RuntimeCompiler" Version="3.5.0" />
<PackageReference Include="JasperFx.CodeGeneration.Commands" Version="3.5.1" />
<PackageReference Include="JasperFx.RuntimeCompiler" Version="3.5.1" />
<PackageReference Include="JasperFx.Core" Version="1.5.1" />
</ItemGroup>

Expand Down

0 comments on commit 66750b4

Please sign in to comment.