Sep 7, 2011 at 2:22 AM
Edited Sep 7, 2011 at 2:57 AM
I am using StructureMap as IOC container.
I would like my MessageHandlers and ErrorHandlers to be able to solve constructor dependencies automatically. These classes are instantiated by the web api framework. Is there a way I can register my own dependency resolver? (Similar as to what I can do in
For example in the code below I want ILogger and IRequestAuthorizerService to be resolved.
Hope it's possible!
public class AuthenticationMessageHandler : DelegatingChannel
public AuthenticationMessageHandler(HttpMessageChannel innerChannel, ILogger logger, IRequestAuthorizerService requestAuthorizer)
*** EDIT ***
Oh no, I ran into IResourceFactory. When trying it out I get this YSOD. So it seems this is currently not possible...
Invalid type: 'AuthenticationMessageHandler'.
It must inherit from base type 'DelegatingChannel', cannot be abstract,
and must expose a public constructor taking a single argument of type 'HttpMessageChannel'.