public static void RegisterComponents()
        {
            var container = new UnityContainer();

            container.RegisterType <IUnitOfWork, UnitOfWork.UnitOfWork>();

            var unityHubActivator = new UnityHubActivator(container);

            GlobalHost.DependencyResolver.Register(typeof(IHubActivator), () => unityHubActivator);

            // register all your components with the container here
            // it is NOT necessary to register your controllers

            // e.g. container.RegisterType<ITestService, TestService>();

            DependencyResolver.SetResolver(new UnityDependencyResolver(container));
        }
Exemple #2
0
        private void RegisterComponents()
        {
            var container = new UnityContainer();

            var unityHubActivator = new UnityHubActivator(container);

            // register all your components with the container here
            // it is NOT necessary to register your controllers

            // e.g. container.RegisterType<ITestService, TestService>();

            container.RegisterType <IDataStorageService <List <Client> >, CacheDataStorageService <List <Client> > >();
            container.RegisterType <IClientService, ClientService>();

            GlobalHost.DependencyResolver.Register(typeof(IHubActivator), () => unityHubActivator);

            GlobalConfiguration.Configuration.DependencyResolver = new UnityDependencyResolver(container);
        }