-
Notifications
You must be signed in to change notification settings - Fork 3
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
Symbolic Service Disposal #80
base: develop
Are you sure you want to change the base?
Conversation
|
740842d
to
f7e3efe
Compare
This commit introduces a new method to the ContainerInstance class: resetValuesLazily. This method returns an iterator which lazily disposes each service in the container. The main advantage of this method is that, for each iteration, it yields both the ID of the service being disposed, alongside a "status" member, which signifies the progress of the service's disposal routine.
This allows classes to implement it.
f7e3efe
to
bc31fab
Compare
This PR introduces the ability for the container to utilise a service's
Symbol.dispose
method, along withasyncDispose
to dispose of it.A new token, aptly named
DISPOSE
is also introduced, which allowsthe caller to prevent the calling of the native, Symbol-based methods,
in favour of a method dedicated to disposing the service when the DI
container tells it to. This allows the service to provide custom handling
for DI-incurred disposals.
Compatibility with the old, string-based
dispose
method API is kept,to prevent breakages in current applications. However, migration away
from this is strongly recommended, as it may cause unexpected behaviour.
Fixes #4.