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

Check if constructor can be used without creating arguments #51

Closed SimonG96 closed 2 years ago

SimonG96 commented 2 years ago

Currently when trying to find a possible constructor, missing arguments are resolved if possible:

https://github.com/SimonG96/LightweightIocContainer/blob/9e957dac5abe8c34cd6aa732183463e047a99b2b/LightweightIocContainer/IocContainer.cs#L560

Whenever a constructor isn't selected there still might be arguments that get created. If these arguments are registered as singletons they are created, added to the instances list and might not even be needed.

Try to find an option to check if constructors can be used without creating arguments first. If the constructor is selected the arguments can be created.