WCF Unity 和对象处理
如果使用 Unity 与 WCF 并使用本文所示的实现:WCF 和 Unity 2.0 是否有任何明确的处置活动需要您关注?
例如,假设服务上的操作正在使用非托管资源作为构造注入参数,那么如何正确处理它?另外,我假设不存在通过 Unity 实例化的托管资源的问题,并且它们将在服务完成时释放?即每次通话后。
谢谢
If using Unity with WCF using an implementation such as that shown in this article: WCF and Unity 2.0 are there any explicit disposal activities you need to be concerned about?
For example, let's assume an operation on the service is using an unmanaged resource as a construction injection parameter, how would this get disposed of properly? Also, I assume there is no concerns with managed resources that are being instantiated via Unity and they will be released when the service is finished with? i.e. after each call in per call.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这取决于您所选择的注射寿命管理。我写了关于 Unity 中不同生命周期管理器的文章 。简而言之 - 只有 ContainerControlledLifetimeManager (单例)和 HiearchicalLifetimeManager 将为您处理处置。在所有其他情况下,您有责任处理注射剂的处置。
It depends on selected lifetime management of your injections. I wrote the article about different lifetime managers in Unity. In short - only
ContainerControlledLifetimeManager
(singleton) andHiearchicalLifetimeManager
will handle dispose for you. In all other cases you are responsible for handling disposal of injections.