We have a .net core application that hosts a NSB endpoint. We are using Autofac container to share dependencies between both .net core controllers and NSB pipeline. When registering services to their implementation, there are some services that are configured using Autofac’s InstancePerRequest scope. I want the resolve the types registered with InstancePerRequest scope (scoped to HTTPContext object that is part of .net core request pipeline) inside a custom NSB Behavior (a class inheriting from
Behavior<IOutgoingLogicalMessageContext>). My current implementation always return a new instance of the service (transient scope) when I try to access the instance using the context argument of Invoke method of the behavior.
Do you know how I can resolve this issue?