-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBootstrapper.cs
39 lines (34 loc) · 1.21 KB
/
Bootstrapper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using Microsoft.Practices.Unity;
using Resolver;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using Unity.Mvc5;
namespace BookingTek.API.App_Start
{
public static class Bootstrapper
{
public static void Initialise()
{
var container = BuildUnityContainer();
System.Web.Mvc.DependencyResolver.SetResolver(new UnityDependencyResolver(container));
// register dependency resolver for WebAPI RC
GlobalConfiguration.Configuration.DependencyResolver = new Unity.WebApi.UnityDependencyResolver(container);
}
private static IUnityContainer BuildUnityContainer()
{
var container = new UnityContainer();
RegisterTypes(container);
return container;
}
public static void RegisterTypes(IUnityContainer container)
{
//Component initialization via MEF
ComponentLoader.LoadContainer(container, ".\\bin", "BookingTek.API.dll");
ComponentLoader.LoadContainer(container, ".\\bin", "Service.dll");
ComponentLoader.LoadContainer(container, ".\\bin", "DataModel.dll");
}
}
}