Autofac如何处理非一次性组件 [英] How Does Autofac Handle Non-Disposable Components
问题描述
我已阅读到Autofac在处理IDisposable
资源方面做得很好,但是我很难找到有关不具有任何非托管资源的组件所执行的操作的任何信息,因此不需要实现IDisposable
.我认为这些都是垃圾收集的,但是在这种情况下有任何文档吗?
I have read that Autofac does a good job of disposing IDisposable
resources, but I'm having trouble finding any info on what it does with components that do not have any unmanaged resources, and therefore do not need to implement IDisposable
. I would assume these all get garbage collected, but is there any documentation on this scenario?
更具体地说,实现IDisposable
是否需要所有Autofac解析的组件? 文档声明
Asking more specifically, are all Autofac-resolved components required to implement IDisposable
? The docs state that
要利用自动确定性处置的优势,您的组件必须实现IDisposable.
To take advantage of automatic deterministic disposal, your component must implement IDisposable.
我是否正确理解这是指Autofac解析的任何组件?
Am I correct in understanding this refers to any kind of Autofac-resolved component?
推荐答案
autofac提供了一些有用的文档来管理对象的处置.
There's petty good documentation from autofac on managing the disposal of the objects.
请参阅: https://autofaccn.readthedocs.io/en/latest/lifetime/disposal.html
这篇关于Autofac如何处理非一次性组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!