Comparing to Zenject
Zenject is awesome. However, VContainer has the following advantages:
- Most parts of reflections and assertions are isolated to the Container's build stage.
- Easy to read implementation.
- VContainer has carefully selected features and does not register data-oriented objects in the container or actively inject the View component. This prevents the DI declaration from becoming overly complex.
Code size (v1.3.0)#
API difference#
Basic#
| Zenject | VContainer |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Component#
| Zenject | VContainer |
|---|---|
|
|
|
|
|
|
|
|
|
|
Factory#
Factory with parameter#
Zenject
VContainer
Factory with parameter & resolve dependency at runtime#
Zenject
VContainer
Factory with prefab#
Zenject
VContainer
Misc#
| Zenject | VContainer |
|---|---|
| Not Supported We should load Resources using LoadAsync family. You can use RegisterInstance() etc after loading the Resource. |
| Not supported Duplicate type Resolve is not recommended. You can instead use type-specific Register builder.Register(Lifetime.Scoped).WithParameter("foo", foo) |