Swinject / SwinjectAutoregistration

Swinject extension to automatically register your services
MIT License
249 stars 45 forks source link

Reason for container.autoregister with max of 3 arguments only #65

Closed loilee closed 2 years ago

loilee commented 3 years ago

I am using container.autoregister with arguments to dynamically mock dependencies for unit testing. However I find that the arguments parameter can only have max of 3, any reason why?

tkohout commented 2 years ago

The reason is combinatorics. We support 20 dependencies with 3 dynamic arguments.

That means generating 60 autoregister functions. Having e.g. 5 arguments would mean generating 100 functions which further increases the size of the library.

You can try by cloning the repo and running bin/generate 20 5