Dependency Injection in "Classic" ASP.NET WebForms, ASP.NET MVC, ASP.NET Web API, and ASP.NET-hosted WCF using Microsoft.Extensions.DependencyInjection.
The T4 template searches the template's project to look for non-static, classes, with no constructor. A constructor will be added per class that will take all private instance fields of that type as input.
DiConstructorGeneratorExtension for Visual Studio companion library. Containins marker attributes to include\exclude class members to be used with extesnion. The extension itself is available at https://marketplace.visualstudio.com/items?itemName=Koshelew.DiConstructorGeneratorExtension