Writing Clean Code in ASPNET Core with DI
Date Published: 27 May 2016
I’ve started writing a series on ASP.NET Core for MSDN Magazine. If you’re not a subscriber to the dead trees version, you can read them online. My first article is on Writing Clean Code in ASP.NET Core with Dependency Injection, in the May 2016 issue. Here’s a brief intro:
ASP.NET Core 1.0 is a complete rewrite of ASP.NET, and one of the main goals for this new framework is a more modular design. That is, apps should be able to leverage only those parts of the framework they need, with the framework providing dependencies as they’re requested. Further, developers building apps using ASP.NET Core should be able to leverage this same functionality to keep their apps loosely coupled and modular. With ASP.NET MVC, the ASP.NET team greatly improved the framework’s support for writing loosely coupled code, but it was still very easy to fall into the trap of tight coupling, especially in controller classes.
My next articles cover middleware and filters, and should appear in the June and July issues, respectively. You can also learn more about dependency injection from my article in the ASP.NET Core docs, or at a higher level,dependency injection on DevIQ.
Steve is an experienced software architect and trainer, focusing on code quality and Domain-Driven Design with .NET.