Skip to content

Latest commit

 

History

History
25 lines (20 loc) · 1.14 KB

README.md

File metadata and controls

25 lines (20 loc) · 1.14 KB

T4 WebForms Injection

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.

Targets subclasses of

  • 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

Requirements

  • 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

Steps to install/configure

  • Install T4WebFormsInjection in your app using NuGet
  • Edit the configuration file
  • Run custom tool to generate the template

Credits