T4 WebForms Injection is a T4 template for ASP.NET WebForms that creates parameterless constructors for classes that have a dependency injectable constructor, but are created via a sealed factory.
- System.Web.UI.MasterPage
- System.Web.UI.Page
- System.Web.UI.UserControl
- System.Web.IHttpHandler
- System.Web.IHttpModule
- Additional base classes can be added/removed via T4WebFormsInjection.tt.settings.xml
- The target class must be partial
- No parameterless constructor can already exist (a compiler error will be thrown if one already exists)
- Every parameter in the constructor will be injected
- Install T4WebFormsInjection in your app using NuGet
- Edit the configuration file
- Run custom tool to generate the template
- Settings code harvested from T4MVC
- Manager.tt from Damien Guard