NServiceBus 7.3.0
NServiceBus.Extensions.DependencyInjection 1.0.1
It’s not clear from the docs
and Custom Serializer for Data Bus • NServiceBus Samples • Particular Docs the correct approach for using a custom data bus serializer with an existing container.
I’m using StructureMap via Microsoft DependencyInjection and have tried adding the registration registry.For<IDataBusSerializer>().Use<JsonDataBusSerializer>();
to the registry from which I create a StructureMapServiceProviderFactory
to pass to EndpointConfig.UseContainer
. This doesn’t seem to be enough though - I also need to add endpointConfig.RegisterComponents(x => x.ConfigureComponent<JsonDataBusSerializer>(DependencyLifecycle.SingleInstance));
but that feels like I’m mixing two DI approaches?
Have I got something wrong here? Thanks in advance.