container icon indicating copy to clipboard operation
container copied to clipboard

Remove IDisposable from SynchronizedLifetimeManager implementation

Open ENikS opened this issue 6 years ago • 0 comments

Description

ExternallyControlledLifetimeManager is a manager that holds reference to an object that is not being controlled or participate in container's lifetime. However, because it is derived from SynchronizedLifetimeManager it inherits implementation of IDisposable

Problem

Implementing IDisposable forces container to store the manager in container's lifetime container and as result creates overhead during registration and container disposal.

Solution

Interface IDisposable should be removed from SynchronizedLifetimeManager and applied to individual Lifetime Managers. The actual implementation will be left without changes so derived managers would not be required to re-implement it.

Impact

Custom lifetime managers should be evaluated and decorated with the IDisposable interface if disposal is required.

ENikS avatar May 27 '20 21:05 ENikS