asp.net web api - What's the equivalent of CastleWindsor's container.Release in LightInject? -
i saw asp.net web api dependency injection in seemann's site. uses castlewindsor though.
request.registerfordispose( new release( () => this.container.release(controller)));
what's equivalent of castlewindsor's container.release in lightinject?
http://blog.ploeh.dk/2012/10/03/dependencyinjectioninasp.netwebapiwithcastlewindsor/
there not release method in lightinject. disposable services registered either perscopelifetime og perrequestlifetime.
these services disposed when surrounding scope disposed.
container.register<ifoo, disposablefoo>(new perscopelifetime()) using(container.beginscope()) { var foo = container.getinstance<ifoo>() } -- foo disposed here
lightinject.webapi provides integration web api takes care of disposing controllers when web request ends.
Comments
Post a Comment