InstancePerLifetimeScopein ASP.NET Core is created and disposed on each request. It's definitely not necessary to implement
IDisposibleon each class. Even without Autofac it might not be required unless the class is really holding lots of state. This accepted answer here is quite good:
and the other side of this internal argument wants every service that depends on the db context to explicitly dispose it
That definitely doesn't sound like the right idea. Even if there were events running in the background, you can let autofac dispose the object and just implement
IDisposable in that specific to stop the listener.
IDisposableinstance directly for internal purposes then it should dispose it because the container does not known about it. If the class has an
IDisposabledependency injected into it then the container will dispose it for you when the time is right. IMHO, lifetime management is probably the single greatest feature the container provides. https://nblumhardt.com/2011/01/an-autofac-lifetime-primer/
IDisposablein .NET. A class that accepts a dependency has no way at all of knowing whether it uniquely uses that dependency, or if it is shared with other consumers - disposing it then becomes arbitrary and prone to causing
ObjectDisposedExceptions for other consumers.