Bre*_*ias 6 .net structuremap enterprise-library unity-container
自2011年2月以来,Unity是否改进了这个委托故事以实现与StructureMap的平等?
Chr*_*res 10
是.实际上,这与Unity 1.0一起作为注入工厂扩展而附带,因此博客文章对于不在那里的能力是错误的.
在Unity 2.0中,故事变得更加容易.你可以做:
container.RegisterType<IWhatever>(
new InjectionFactory(container => whateverFunctionYouWant()));
Run Code Online (Sandbox Code Playgroud)
这导致瞬态登记; 你可以使用你想要的任何终身经理.