Add INonLazy interface for immediate instantiation via RegisterEntryPoint#846
Open
Ceeeeed wants to merge 1 commit intohadashiA:masterfrom
Open
Add INonLazy interface for immediate instantiation via RegisterEntryPoint#846Ceeeeed wants to merge 1 commit intohadashiA:masterfrom
INonLazy interface for immediate instantiation via RegisterEntryPoint#846Ceeeeed wants to merge 1 commit intohadashiA:masterfrom
Conversation
Introduces the INonLazy interface to support non-lazy entry point registration in the container.
|
@Ceeeeed is attempting to deploy a commit to the hadashia's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
Adds a marker-interface-based mechanism to force eager (non-lazy) instantiation of certain entry points during EntryPointDispatcher.Dispatch(), plus a unit test demonstrating the behavior.
Changes:
- Introduce
INonLazymarker interface underVContainer.Unity. - Eagerly resolve
INonLazyimplementations at the start ofEntryPointDispatcher.Dispatch(). - Add a Unity test fixture and test case validating immediate instantiation on
Build().
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
VContainer/Assets/VContainer/Runtime/Unity/EntryPointDispatcher.cs |
Forces resolution of INonLazy collection prior to running other entry point lifecycle phases. |
VContainer/Assets/VContainer/Runtime/Annotations/INonLazy.cs |
Adds the INonLazy marker interface. |
VContainer/Assets/VContainer/Runtime/Annotations/INonLazy.cs.meta |
Unity asset metadata for the new interface file. |
VContainer/Assets/Tests/Unity/UnityContainerBuilderTest.cs |
Adds a test asserting that a non-lazy entry point is instantiated during container build. |
VContainer/Assets/Tests/Unity/Fixtures/SampleEntryPoint.cs |
Adds SampleNonLazyEntryPoint test fixture implementing INonLazy. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a new approach to support non-lazy initialization, inspired by previous discussions around the
NonLazy()method. Instead of using a separateNonLazy()API, I provide anINonLazymarker interface.Perhaps this approach will be more aligned with the repository owner's preferences. For reference, see the previous discussion: PR #574.
Key Points
INonLazywill be automatically instantiated when registered viaRegisterEntryPoint, ensuring immediate construction.Initialize()implementations solely to trigger early instantiation.RegisterEntryPoint(), maintaining API consistency and clarity.Example Usage