Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WeakReferenceLifetimeManager #6

Closed
ENikS opened this issue Dec 11, 2019 · 0 comments · May be fixed by #11 or #12
Closed

Add WeakReferenceLifetimeManager #6

ENikS opened this issue Dec 11, 2019 · 0 comments · May be fixed by #11 or #12
Assignees
Milestone

Comments

@ENikS
Copy link
Contributor

ENikS commented Dec 11, 2019

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

@ENikS ENikS self-assigned this Dec 11, 2019
@ENikS ENikS transferred this issue from unitycontainer/abstractions Dec 12, 2019
@ENikS ENikS added this to the 0.3.0 milestone Apr 10, 2020
@ENikS ENikS linked a pull request Apr 11, 2020 that will close this issue
@ENikS ENikS removed a link to a pull request Apr 11, 2020
@ENikS ENikS closed this as completed Apr 11, 2020
This was linked to pull requests Apr 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant