Re:.NET Myths Dispelled
by spaetzleesser on Sunday March 13, 2022 @08:30AM
(#30660666)
I did that too and it should be the default. Constructor injection is a bad pattern.
[ Parent
| on HN ]
What do you mean by "constructor injection"?
Re:.NET Myths Dispelled
by spaetzleesser on Sunday March 13, 2022 @12:38PM
(#30662922)
In .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.
Comments like these really amaze me. What sort of competent editor cannot handle such simple refactorings?
My comment describes a way to organize unit tests to work around this issue.
Re:.NET Myths Dispelled
by hackerfromthefu on Monday March 14, 2022 @07:18AM
(#30671004)
Maybe 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.