I need to pass some arguments to a custom AbstractLifestyleManager derived type.
When I request an instance of a type from the container, I use the following overload:
T Resolve<T>(string key, object argumentsAsAnonymousType)
For example:
public IHttpController CreateController(HttpControllerContext controllerContext, string controllerName)
{
var controller = this.container.Resolve<IHttpController>(
controllerName,
new { requestProperties = controllerContext.Request.Properties });
// ...
}
Then, inside the custom AbstractLifestyleManager derived type, I can do this:
var messageProperties = (IDictionary<string, object>)
context.AdditionalArguments["requestProperties"];
Which returns the value that I have previsouly passed.
However, if I call base.Resolve(context, releasePolicy)
the AdditionalArguments is null if the code enters the custom type recursively.
Is it possible to pass/flow the AdditionalArguments between the base.Resolve
calls?