Skip to content

Commit d3f0835

Browse files
Migrate saga mappings to MapSaga().ToMessage() API (#844)
* Initial plan * Update saga mappings to use MapSaga().ToMessage() syntax Co-authored-by: danielmarbach <174258+danielmarbach@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: danielmarbach <174258+danielmarbach@users.noreply.github.com>
1 parent 2c484ab commit d3f0835

File tree

6 files changed

+8
-7
lines changed

6 files changed

+8
-7
lines changed

src/NServiceBus.Storage.MongoDB.AcceptanceTests/When_custom_provider_registered.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public Task Handle(StartSaga1 message, IMessageHandlerContext context)
5050
return Task.CompletedTask;
5151
}
5252

53-
protected override void ConfigureHowToFindSaga(SagaPropertyMapper<JustASagaData> mapper) => mapper.ConfigureMapping<StartSaga1>(m => m.DataId).ToSaga(s => s.DataId);
53+
protected override void ConfigureHowToFindSaga(SagaPropertyMapper<JustASagaData> mapper) => mapper.MapSaga(s => s.DataId).ToMessage<StartSaga1>(m => m.DataId);
5454
}
5555

5656
public class CustomProvider(Context testContext) : IMongoClientProvider

src/NServiceBus.Storage.MongoDB.AcceptanceTests/When_mixing_persistence_with_other_persistence_for_sagas_and_outbox.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public Task Handle(StartSaga message, IMessageHandlerContext context)
5858

5959
protected override void ConfigureHowToFindSaga(SagaPropertyMapper<MySagaData> mapper)
6060
{
61-
mapper.ConfigureMapping<StartSaga>(m => m.DataId).ToSaga(s => s.DataId);
61+
mapper.MapSaga(s => s.DataId).ToMessage<StartSaga>(m => m.DataId);
6262
}
6363

6464
public class MySagaData : ContainSagaData

src/NServiceBus.Storage.MongoDB.AcceptanceTests/When_storing_saga_with_high_contention.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ public HighContentionSaga(Context testContext)
8585

8686
protected override void ConfigureHowToFindSaga(SagaPropertyMapper<HighContentionSagaData> mapper)
8787
{
88-
mapper.ConfigureMapping<StartSaga>(m => m.SomeId).ToSaga(d => d.SomeId);
89-
mapper.ConfigureMapping<AdditionalMessage>(m => m.SomeId).ToSaga(d => d.SomeId);
88+
mapper.MapSaga(d => d.SomeId)
89+
.ToMessage<StartSaga>(m => m.SomeId)
90+
.ToMessage<AdditionalMessage>(m => m.SomeId);
9091
}
9192

9293
public async Task Handle(StartSaga message, IMessageHandlerContext context)

src/NServiceBus.Storage.MongoDB.Tests/Sagas/Migration/When_migrating_NServiceBus_dot_MongoDB.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public Task Handle(MigrationStartMessage message, IMessageHandlerContext context
6060

6161
protected override void ConfigureHowToFindSaga(SagaPropertyMapper<NServiceBusMongoDBLegacySagaData> mapper)
6262
{
63-
mapper.ConfigureMapping<MigrationStartMessage>(msg => msg.Id).ToSaga(saga => saga.Id);
63+
mapper.MapSaga(saga => saga.Id).ToMessage<MigrationStartMessage>(msg => msg.Id);
6464
}
6565
}
6666

src/NServiceBus.Storage.MongoDB.Tests/Sagas/Migration/When_migrating_NServiceBus_dot_Persistence_dot_MongoDb.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public Task Handle(MigrationStartMessage message, IMessageHandlerContext context
5050
protected override void ConfigureHowToFindSaga(
5151
SagaPropertyMapper<NServiceBusPersistenceMongoDBLegacySagaData> mapper)
5252
{
53-
mapper.ConfigureMapping<MigrationStartMessage>(msg => msg.Id).ToSaga(saga => saga.Id);
53+
mapper.MapSaga(saga => saga.Id).ToMessage<MigrationStartMessage>(msg => msg.Id);
5454
}
5555
}
5656

src/NServiceBus.Storage.MongoDB.Tests/Sagas/PropertyTypesTestSaga.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public Task Handle(PropertyTypesTestSagaDataStartMessage message, IMessageHandle
1414

1515
protected override void ConfigureHowToFindSaga(SagaPropertyMapper<PropertyTypesTestSagaData> mapper)
1616
{
17-
mapper.ConfigureMapping<PropertyTypesTestSagaDataStartMessage>(msg => msg.Id).ToSaga(saga => saga.Id);
17+
mapper.MapSaga(saga => saga.Id).ToMessage<PropertyTypesTestSagaDataStartMessage>(msg => msg.Id);
1818
}
1919
}
2020

0 commit comments

Comments
 (0)