Swinject/SwinjectAutoregistration

Increase the maximum number of supported dependencies

vminc opened this issue · 4 comments

vminc commented

I find this library extremely useful however currently it is limited to maximum of 9 dependencies. Can we increase this number to say 20?

Hello @vminc, glad you find the library useful. The original reason to limit the number of dependencies was to shorten the build times. But with further optimizations and compiler hints it looks like it can be increased.

Although I haven't have the need for more than 9 dependencies in my projects, would you mind to share your use case?

vminc commented

Thanks. My use case isn't particularly special. I just find that in rare cases the number of dependencies I have for a class can go up to 10-11. Currently I have to get around this in a hacky way by wrapping half of the dependencies into a wrapper class.

@vminc I would describe your solution of wrapping them in a wrapper class to be the actual best solution. Its often suggested that having too many dependancies is a sign that the class is too large and complex, and should likely be broken up into smaller classes.

Included in v2.0.1