Skip to content

Add WeakReferenceLifetimeManager  #6

Closed
@ENikS

Description

@ENikS

Description

Current implementation of ExternallyControlledLifetimeManager could be used for either:

  • registering external instance
  • registering type or factory

The container will return instance if it is present or, if already collected or never created, will attempt to create new instance. This behavior is incorrect.

In case of instance registration, it can only be used until collected by the GC. Once collected, container should throw an exception when instance is requested.

If type or factory is registered with this manager it should create new instance and use it until collected. Once collected it should recreate it and so on. (This scenario is useful in all kinds of cache scenarios)

The solution for this issue is to reserve ExternallyControlledLifetimeManager for instance registrations only and create a new manager WeakReferenceLifetimeManager to cover type and factory weak reference registrations.

See Also

Issue unitycontainer/abstractions#114

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions