TLDR; How can I properly create a mutator that has dependencies?
I am building a solution that serialized a bag of data that is initialised by an API Middleware pipeline this data is currently registered as per LifetimeScope in, Autofac terms, I am able to resolve this dependency on the controller, but later on when I try to resolve this dependency within a mutator that should serialize the bag of data into a header, it is no longer available.
I have tried registering the Mutator with InstancePerCall and InstancePerUnitOfWork but neither gives me the object in the same state as on the controller. Does the sending pipeline create a new scope?
I have created the mutator implementing
IMutateOutgoingTransportMessages and registered it through
RegisterComponents(components => components.Configure<Mutator>(DependencyLifecycle.InstancePerCall)) on the
I’ve placed a breakpoint in the MutateOutgoing method and the constructor but I never hit the constructor, not sure why this is, but more importantly, the constructor injected dependency is no longer the initialised bag of data.
Thanks in advanced!