Пример #1
0
        public static void RegisterUnity()
        {
            IUnityContainer container = UnityContainerConfig.RegisterTypes();

            UnityDependencyResolver resolver = new UnityDependencyResolver(container);

            // for MVC Controllers
            DependencyResolver.SetResolver(resolver);

            // for WEB API Controllers
            GlobalConfiguration.Configuration.DependencyResolver = resolver;
        }
        public static void RegisterUnity()
        {
            IUnityContainer container = UnityContainerConfig.RegisterTypes();

            UnityDependencyResolver resolver = new UnityDependencyResolver(container);

            // for MVC Controllers
            DependencyResolver.SetResolver(resolver);

            // for WEB API Controllers
            GlobalConfiguration.Configuration.DependencyResolver = resolver;
        }