3 ms·
I did that too and it should be the default. Constructor injection is a bad pattern.
by spaetzleesser 5y ago
I did that too and it should be the default. Constructor injection is a bad pattern.
- infogulch 5y agoWhat do you mean by "constructor injection"?
- spaetzleesser 5y agoIn .NET a lot of DI is done by adding another interface to the constructor. So if you need some service way down the stack you add it to the constructor. This then in turn can require adding this dependency to all the tests that use this service.
- infogulch 5y agoMy comment describes a way to organize unit tests to work around this issue.
- Van-Dame 5y agoComments like these really amaze me. What sort of competent editor cannot handle such simple refactorings?
- hackerfromthefu 5y agoMaybe but in Blazor you have the choice of Property or Constructor DI. This choice is in all the major DI container libraries I've worked with in .NET, around a dozen over the years.