-
-
Notifications
You must be signed in to change notification settings - Fork 840
Invoke Build Callbacks at Lifetime Scope Creation #1054
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
Conversation
…iner, and switch the build callbacks to behave like a registered component that gets resolved at container build time or lifetime scope creation time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a nice, elegant way to solve the whole thing and unify the way callbacks are done. Great job!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if we can remove the nullable notes we're good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Following the discussion in #985, these changes allow build callbacks to execute at the point of lifetime scope creation if new ones have been registered.
So, this works:
The callback will be invoked just prior to BeginLifetimeScope exiting, after any startable components are instantiated (same behaviour as the Container).
As discussed, we now register a component
BuildCallbackService
that contains the set of callbacks to register; nested scopes then add replacement registrations of that service.BuildCallbackManager
is responsible for executing the callbacks.Fixes #985