Exercise Files
This commit is contained in:
26
Ch03/03_Solution/Website/App_Start/Dependencies.cs
Normal file
26
Ch03/03_Solution/Website/App_Start/Dependencies.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Autofac;
|
||||
using Autofac.Integration.Mvc;
|
||||
|
||||
namespace HPlusSports.App_Start
|
||||
{
|
||||
public class Dependencies
|
||||
{
|
||||
public static void Register()
|
||||
{
|
||||
var builder = new ContainerBuilder();
|
||||
builder.RegisterControllers(typeof(Dependencies).Assembly);
|
||||
builder.RegisterType<HPlusSportsDbContext>()
|
||||
.InstancePerRequest();
|
||||
|
||||
var container = builder.Build();
|
||||
|
||||
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user