Description
Currently RegisterType, RegisterInstance, etc. will accept any lifetime manager with no regard if it is compatible with corresponding registration type.
Problem
It is possible to register instance with TransientLifetimeManager, for example.
Solution
Add following interfaces to specify compatible registration type for the lifetime managers:
public interface IFactoryLifetimeManager { }
public interface IInstanceLifetimeManager { }
public interface ITypeLifetimeManager { }
Change IUnityContainer interface to support these interfaces:
public interface IUnityContainer : IDisposable
{
... RegisterType(..., ITypeLifetimeManager lifetime, . . .);
... RegisterInstance(..., IInstanceLifetimeManager lifetime);
... RegisterFactory(..., IFactoryLifetimeManager lifetime);
. . .
}
Description
Currently RegisterType, RegisterInstance, etc. will accept any lifetime manager with no regard if it is compatible with corresponding registration type.
Problem
It is possible to register
instancewithTransientLifetimeManager, for example.Solution
Add following interfaces to specify compatible registration type for the lifetime managers:
Change IUnityContainer interface to support these interfaces: