Version 2.0.0 #57
Closed
PereViader
announced in
Announcements
Replies: 1 comment 9 replies
-
Hi! I've updated project to 2.0.0 and I'm now getting null container in MonoBehaviourSubordinateEntryPoint |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Version 2.0.0 is now up!
I believe the codebase is stable enough and that the documentation is good enough to merit releasing already.
There is still plenty that we want to improve so expect even more updates!
The API of the container has been overhauled and the container has been split in two variants
ManualDi.Main
|-> ManualDi.Sync
|-> ManualDi.Async
ManualDi.Sync is an almost direct replacement for the previous library
ManualDi.Main
.If you are to choose one of the variants, I recommend going with the Async variant given it allows for a deeper integration with async loading and initialization workflows that are typical in games.
In order to update you will need to update the openupm package manager to point to the new repository https://openupm.com/packages/com.pereviader.manualdi.sync.unity3d/
If you want to move to the new async variant
https://openupm.com/packages/com.pereviader.manualdi.async.unity3d/
Here are the changes where ManualDi.Sync differs from ManualDi.Main
Transient bindings were removed, bindings will now always be Single. Transient bindings prevent us from implementing the Async variant of the container and there was always little to no use for them. In case you need something similar, create a factory class that can create new instances when needed.
Lazy bindings were removed. All bindings will now be NonLazy. Lazy binding functionality might be nice but came at the cost of unexpected complexity in spots where part of the object graph was not resolved. This also prevented us from implementing the Async variant of the container.
Inject attribute was removed. The library promotes having completely clean types that don't reference the container. This pattern goes against the principle that we wanted to container to follow. Property injection is now not supported by the container source generation and all injection must go through the source generated Inject method.
WithStartup
renamed toQueueStartup
Several changes in names to streamline the container.
A new variant of the library ManualDi.Async is now introduced. This new variant allows clients to create and initialize object asynchronously. This allows the introduction of new extension methods that to integrate ManualDi with async APIs. For example in Unity3d we can now do the following
The snippet above will load the asset and scene, get the component from them and make sure that when the container is disposed and that the relevant assets are properly unloaded.
From an external API point of view, only the construction and disposal of the container changes. It now has an async API.
Before
After
In order for the Async container to be able to resolve the dependencies in the proper order on async code paths, we had to update the resolution pipeline of the container. If you manually implement FromMethod, you will now need to call the
DependsOn
method on the binding with the relevant dependencies.This will however only be necessary if you DONT use the source generated methods. In case you do use them, the api you should use will be the same
Beta Was this translation helpful? Give feedback.
All reactions