SimonG96 / LightweightIocContainer

A lightweight IOC Container that is powerful enough to do all the things you need it to do.
MIT License
4 stars 2 forks source link

Allow passing of parameters to registration in an `IIocInstaller` #29

Closed SimonG96 closed 5 years ago

SimonG96 commented 5 years ago

The user should be able to pass a parameter to the constructor of the registered class from the IIocInstaller. This has to be possible within the fluent registration of the type (similar to OnCreate()).

Initial idea:
Add a function Parameters(params object[] parameters) to IDefaultRegistration<> and pass the given arguments to the ResolveInternal<>() or the CreateInstance<>() method when the type is resolved.

Problem:
If multiple parameters of the same type are passed through different ways (passed directly to Resolve<>() or new Parameters() method), how does the container know when to use which parameter?

SimonG96 commented 5 years ago

There is now a Branch for development.