Пример #1
0
        private static IUnityContainer BuildUnityContainer()
        {
            // Unity Container
            var container = new UnityContainer();

            // Add controllers
            container.RegisterControllers();

            // register the services: https://github.com/gzak/Unity.Mvc.Wcf
            container.RegisterWcfClientFor<ITaskService>("BasicHttpBinding_ITaskService");

            // Register the gateways
            container.RegisterType<ITaskGateway, TaskGateway>(
                            new HierarchicalLifetimeManager(),
                            new InjectionConstructor(container.Resolve<ITaskService>()));

            return container;
        }