问题
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?
EDIT
Asking more specifically, are all Autofac-resolved components required to implement IDisposable
? The docs state that
To take advantage of automatic deterministic disposal, your component must implement IDisposable.
Am I correct in understanding this refers to any kind of Autofac-resolved component?
回答1:
There's petty good documentation from autofac on managing the disposal of the objects.
See: https://autofaccn.readthedocs.io/en/latest/lifetime/disposal.html
来源:https://stackoverflow.com/questions/60213990/how-does-autofac-handle-non-disposable-components