hadashiA / VContainer

The extra fast, minimum code size, GC-free DI (Dependency Injection) library running on Unity Game Engine.
https://vcontainer.hadashikick.jp
MIT License
1.89k stars 165 forks source link

Added option to lazily create paramaters and use the scope's resolver #570

Closed AlonTalmi closed 6 months ago

AlonTalmi commented 10 months ago

Changed the interface IInjectParameter ( from: Value { get; } to: GetValue(IObjectResolver resolver) )

And added new variations of it called FuncTypedParameter and FuncNamedParameter.

This allows you to add parameters to registrations the can be created lazily/created per transient resolve and can use the IObjectResolver that was used to create the object.

It would be nice to also add in the future the the option to declare a parameter as single (in case the parent register is not)

Added Unit Tests

Edit: Also added option to resolve a parameter from an injector in a separate branch

vercel[bot] commented 10 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
vcontainer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 15, 2023 8:09am
hadashiA commented 6 months ago

Thanks a lot. I am really sorry for the delay in checking.

I will try to merge this.

hadashiA commented 6 months ago

640