Example #1
0
        public static void RegisterTypes <TLifetime>(IUnityContainer container)
            where TLifetime : LifetimeManager, new()
        {
            Data.ContainerConfiguration.RegisterTypes <TLifetime>(container);
            MappersConfiguration.CreateMaps();

            RegisterMappers <TLifetime>(container);
            RegisterServices <TLifetime>(container);
        }
Example #2
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            //FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            MappersConfiguration.CreateMaps();

            var container          = UnityConfig.GetConfiguredContainer();
            var dependencyResolver = new UnityDependencyResolver(container);

            GlobalConfiguration.Configuration.DependencyResolver = dependencyResolver;

            // Replace controller configuration
            GlobalConfiguration.Configuration.Services.Replace(typeof(IHttpControllerSelector),
                                                               new HttpControllerSelector(GlobalConfiguration.Configuration));

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        }