I am able to register a MassTranst SagaStateMachine in a SimpleInjector container using the InMemoryRepository:
container.AddMassTransit(cfg =>
{
// Unrelated registration code ommitted
// ...
cfg.AddSagaStateMachine<FormEvaluateStateMachine, FormEvaluateState>()
.InMemoryRepository();
});
container being the SimpleInjector container.
If I change the line in there to:
cfg.AddSagaStateMachine<FormEvaluateStateMachine, FormEvaluateState>() .RedisRepository();
I get the following error from simple injector:
For the container to be able to create RedisSagaRepositoryContextFactory it should have only one public constructor: it has 2. See https://simpleinjector.org/one-constructor for more information.
So somewhere its trying to register an implementation for RedisSagaRepositoryContextFactory which indeed has two constructors.
Is there an elegant way to solve this? It looks like SimpleInjector offers a kludge to allow for multiple constructors but enabling that anti-pattern on a systemwide basis seems a little heavyhanded.
Is there a way to tell SimpleInjector to only do it for certain types? I assume I want to use the constructor that takes ConnectionMultiplexer but I'm not certain. I would have tagged my post with SimpleInjector but I don't have enough internet points.
Maybe there is a better way to specify the RedisRepository() so this doesn't happen?
I'm also in full framework so maybe not having Redis itself properly registered is my issue?