예제 #1
0
        protected void Application_Start()
        {
            GlobalConfiguration.Configure(WebApiConfig.Register);

            CRM.BL.IoCManager      crmIoc      = new CRM.BL.IoCManager();
            BI.BL.IoCManager       biIoc       = new BI.BL.IoCManager();
            Invoices.BL.IoCManager invoicesIoc = new Invoices.BL.IoCManager();

            Container container = new Container();

            container.Register <IBIStatistics>(() => biIoc.GetInstanceOf <IBIStatistics>());

            container.Register <IClientsManager>(() => crmIoc.GetInstanceOf <IClientsManager>());
            container.Register <ILinesManager>(() => crmIoc.GetInstanceOf <ILinesManager>());
            container.Register <Common.CRM.IAuthenticator>(() => crmIoc.GetInstanceOf <Common.CRM.IAuthenticator>());

            container.Register <IInvoicesProducer>(() => invoicesIoc.GetInstanceOf <IInvoicesProducer>());
            container.Register <Common.Invoices.IAuthenticator>(() => invoicesIoc.GetInstanceOf <Common.Invoices.IAuthenticator>());
            container.Register <IOptimalPackageCalculator>(() => invoicesIoc.GetInstanceOf <IOptimalPackageCalculator>());
            container.Register <ISimulator>(() => invoicesIoc.GetInstanceOf <ISimulator>());

            container.RegisterWebApiControllers(GlobalConfiguration.Configuration);

            container.Verify();

            GlobalConfiguration.Configuration.DependencyResolver =
                new SimpleInjectorWebApiDependencyResolver(container);
        }
예제 #2
0
        protected void Application_Start()
        {
            GlobalConfiguration.Configure(WebApiConfig.Register);

            CRM.BL.IoCManager      crmIoc      = new CRM.BL.IoCManager();
            BI.BL.IoCManager       biIoc       = new BI.BL.IoCManager();
            Invoices.BL.IoCManager invoicesIoc = new Invoices.BL.IoCManager();

            Container container = new Container();

            container.Register <IBIStatistics>(() => biIoc.GetInstanceOf <IBIStatistics>());

            container.Register <IClientsManager>(() => crmIoc.GetInstanceOf <IClientsManager>());
            container.Register <ILinesManager>(() => crmIoc.GetInstanceOf <ILinesManager>());
            container.Register <Common.CRM.IAuthenticator>(() => crmIoc.GetInstanceOf <Common.CRM.IAuthenticator>());

            container.Register <IInvoicesProducer>(() => invoicesIoc.GetInstanceOf <IInvoicesProducer>());
            container.Register <Common.Invoices.IAuthenticator>(() => invoicesIoc.GetInstanceOf <Common.Invoices.IAuthenticator>());
            container.Register <IOptimalPackageCalculator>(() => invoicesIoc.GetInstanceOf <IOptimalPackageCalculator>());
            container.Register <ISimulator>(() => invoicesIoc.GetInstanceOf <ISimulator>());

            container.RegisterWebApiControllers(GlobalConfiguration.Configuration);

            container.Verify();

            GlobalConfiguration.Configuration.DependencyResolver =
                new SimpleInjectorWebApiDependencyResolver(container);

//            GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings
//.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.All;
        }