开发者

Unity Container Disposing and XML Web Service

I开发者_如何学Go am registering some wrapers over un-managed objects in container. How can I dispose of them at the end of the container's lifetime? Please bear in mind I have an XML Web service.


Most DI Containers have a functionality to dispose of created objects. Typically, a Resolve method has a corresponding method that can dispose of the created object graph.

In Unity, this method is called Teardown.

When your web request is done, you should pass your object graph to the Teardown method to dispose of any IDisposable objects.


As far as I am aware you will have to implement this yourself. I believe Autofac is currently the only .NET container to support this out of the box.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜