You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently how Autofac works is that for the IDisposable type service, Autofac container will manage the disposing, unless it is being set as ExternallyOwned. Autofac does this by placing it on the Disposal queue and call the service when the container is being disposed. This will create a strong reference to the service until the container is disposed.
While I can see the merit of this design, for my use case I would prefer the inversion of it, namely, I want to configure that for default, the IDisposable services that are owned by Autofac are ExternallyOwned ( I'm responsible for calling the Dispose method), and only for a handful of services are "InternallyOwned" ( and I would have to mark them explicitly as such), meaning that for these services, Autofac will be responsible for calling the Dispose method.
Is it possible to do have this API? Or this is already doable in the current Autofac engine?
The text was updated successfully, but these errors were encountered:
Currently how Autofac works is that for the
IDisposable
type service, Autofac container will manage the disposing, unless it is being set asExternallyOwned
. Autofac does this by placing it on the Disposal queue and call the service when the container is being disposed. This will create a strong reference to the service until the container is disposed.While I can see the merit of this design, for my use case I would prefer the inversion of it, namely, I want to configure that for default, the
IDisposable
services that are owned by Autofac are ExternallyOwned ( I'm responsible for calling theDispose
method), and only for a handful of services are "InternallyOwned" ( and I would have to mark them explicitly as such), meaning that for these services, Autofac will be responsible for calling theDispose
method.Is it possible to do have this API? Or this is already doable in the current Autofac engine?
The text was updated successfully, but these errors were encountered: