Skip to content

Provide design time validation for LifetimeManager derivatives #90

Closed
@ENikS

Description

@ENikS

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);

. . .
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions