houseofcat / DependencyInjection.WebForms

Asp.Net WebForms Dependency Injection for Unity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HouseofCat.DependencyInjection.WebForms

Dependency Injection for Asp.Net WebForms (currently only Unity)

How to use

  1. Make sure your web project is targeting .NET Framework 4.8. You can download .NET Framework 4.8 developer pack from here. Check web.config and targetFramework in httpRuntime section should be 4.8.
<system.web>
  <compilation debug="true" targetFramework="4.8"/>
  <httpRuntime targetFramework="4.8"/>
</system.web>
  1. Install HouseofCat.DependencyInjection.WebForms.Unity nupkg in your project.
  2. Open Global.asax.cs and register the types in UnityContainer.
protected void Application_Start(object sender, EventArgs e)
{
    var container = this.AddUnity();

    container.RegisterType<ISomeInterface, SomeImplementation>();
}

Source

Original Repository no longer maintained by Microsoft is found here.

About

Asp.Net WebForms Dependency Injection for Unity

License:MIT License


Languages

Language:C# 100.0%