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

Allow installers to be added to localExtraInstallers #565

Closed pnarimani closed 6 months ago

pnarimani commented 10 months ago

As it is, even though localExtraInstallers is a list, it's not possible to add more than one installer to it.

I added a EnqueueLocalInstaller function to LifetimeScope, which allows users to add more installers to localExtraInstallers list. This function returns an IDisposable struct which removes the added installer.

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 Oct 30, 2023 7:54pm
AlonTalmi commented 10 months ago

From what I see the localExtraInstallers is pretty much a hack used for testing I think it would better to deprecate it then extend it :(

What do you use it for? When creating new LifetimeScopes, the recommended way is by Enqueuing to the GlobalExtraInstallers, which does support multiple installers

hadashiA commented 6 months ago

Thank you. But I agree with AlonTalmi's view. I am not too positive about breaking Installer into smaller pieces.