It would be good if I could pass a type of HttpMessageHandler instead of an instance. That way, the DependencyResolver could automatically resolve the type including any of it's dependencies.
Right now, in order to supply dependencies I have to reference the container itself, or pass a delegate (which will call into the container). However, AFAICT the HttpMessageHandler types are initialized once, in application start so it looks like I will have to manually control the lifetime of the dependencies.
Since the handler is initialized once, if I pass a singleton for the dependency that means it won't get GC'ed at all. On the other hand, I can manually resolve an instance and then release it but I am not happy with this approach as it couples the handler with lifetime management of it's dependencies.
Comments: yeah, i am using dependencyscope in httpmessagehandler as well, it's definitly not a blocking issue for me nethier. but it'll be alot nicer to have it injected from the constructor, much easier to maintain the code and not have a lot of webapi specific code.
Right now, in order to supply dependencies I have to reference the container itself, or pass a delegate (which will call into the container). However, AFAICT the HttpMessageHandler types are initialized once, in application start so it looks like I will have to manually control the lifetime of the dependencies.
Since the handler is initialized once, if I pass a singleton for the dependency that means it won't get GC'ed at all. On the other hand, I can manually resolve an instance and then release it but I am not happy with this approach as it couples the handler with lifetime management of it's dependencies.
Comments: yeah, i am using dependencyscope in httpmessagehandler as well, it's definitly not a blocking issue for me nethier. but it'll be alot nicer to have it injected from the constructor, much easier to maintain the code and not have a lot of webapi specific code.