I'm trying to implement dependency injection for a WCF service hosted in an Azure WebRole that runs in full-trust mode (So there are two separate processes).
I've tried Ninject so far and I had no problems injecting dependencies into the WCF service using the method described in this article: http://tinyurl.com/cnxrscg
However, I still have two unresolved issues:
Kernel
before RoleEntryPoint
, so that I can inject the dependencies I need into it. Am I supposed to create it from there or is there a better practice?Note: I'm not interested in a Ninject-specific solution. As a matter of fact, I've stumbled across many shortcomings while dealing with it so I'm considering a different IoC container. Which one works best with Azure?
Thanks!
Each AppDomain needs its own container. Sharing a container over AppDomains or even across processes is something that is typically not supported by a container, and if it is, it costs a lot of performance, since all the marshalling that will be going on between the two AppDomains. Besides, each AppDomain typically represents its own application, and each application often needs its unique registration. This by itself justifies giving each AppDomain its own container.