Dependency Injection: Inject Your Dependencies, Period!

There is a discussion going on inside ASP.NET/Logging repository whether we should have static Logger available everywhere or not. I am quite against it and I stated why with a few comments there but hopefully with this post, I will try to address why I think the dependency injection path is better for most of the cases.

Let’s take an example and explain it further based on that.

public class FooManager : IFooManager
{
private readonly IClock _clock;
private readonly ILogger _logger;
private...
 •  0 comments  •  flag
Share on Twitter
Published on November 20, 2014 10:34
No comments have been added yet.