inversion of control - How to use Unity's injectionfactory for child containers in ninject? -
i stuck ninjects equivalent unity registration:
var container = new unitycontainer(); container.registertype<myfactory>(new containercontrolledlifetimemanager()); // resolve instances once per child container myfactory container.registertype<imyinstance>(new hierarchicallifetimemanager(), new injectionfactory(c => c.resolve<myfactory>().getmyinstance()));
already tried without effect:
var kernel = new standardkernel(); kernel.bind<myfactory>().toself().insingletonscope(); // context preserving should job child containers, right? // thought in call scope ist equivalent unity's hierarchical lifetime manager? kernel.bind<imyinstance>().tomethod(ctx => ctx.contextpreservingget<myfactory>().getmyinstance()) .incallscope();
Comments
Post a Comment