Exemple #1
0
        /// <summary>
        /// Invoked when the application starts.
        /// </summary>
        protected void Application_Start()
        {
            IMigrationService service;

            try
            {
                AreaRegistration.RegisterAllAreas();

                UnityContainer = UnityConfig.GetConfiguredContainer();

                service = UnityContainer.Resolve <IMigrationService>();

                ApplicationInsights.Extensibility.TelemetryConfiguration.Active.InstrumentationKey =
                    service.Configuration.InstrumentationKey;

                FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
                FilterConfig.RegisterWebApiFilters(GlobalConfiguration.Configuration.Filters);
                GlobalConfiguration.Configure(WebApiConfig.Register);
                RouteConfig.RegisterRoutes(RouteTable.Routes);

                string path = Path.Combine(HttpRuntime.AppDomainAppPath, @"Configuration\WebPortalConfiguration.json");

                IWebPortalConfigurationFactory webPortalConfigFactory = new WebPortalConfigurationFactory();
                PortalConfiguration.WebPortalConfigurationManager = webPortalConfigFactory.Create(path);

                // Setup the application assets bundles
                PortalConfiguration.WebPortalConfigurationManager.UpdateBundles(Bundler.Instance).Wait();
            }
            finally
            {
                service = null;
            }
        }
        /// <summary>
        /// Called when the application starts.
        /// </summary>
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            FilterConfig.RegisterGlobalMvcFilters(GlobalFilters.Filters);
            FilterConfig.RegisterWebApiFilters(GlobalConfiguration.Configuration.Filters);

            // configure the web portal client application
            string portalConfigurationPath = ApplicationConfiguration.WebPortalConfigurationFilePath;

            if (string.IsNullOrWhiteSpace(portalConfigurationPath))
            {
                throw new ConfigurationErrorsException("WebPortalConfigurationPath setting not found in web.config");
            }

            // create the web portal configuration manager
            IWebPortalConfigurationFactory webPortalConfigFactory = new WebPortalConfigurationFactory();

            ApplicationConfiguration.WebPortalConfigurationManager = webPortalConfigFactory.Create(portalConfigurationPath);

            // setup the application assets bundles
            ApplicationConfiguration.WebPortalConfigurationManager.UpdateBundles(Bundler.Instance).Wait();

            // intialize our application domain
            ApplicationDomain.InitializeAsync().Wait();
        }
Exemple #3
0
        /// <summary>
        /// Called when the application starts.
        /// </summary>
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            Database.SetInitializer <ApplicationDbContext>(null);

            string portalConfigurationPath = ApplicationConfiguration.WebPortalConfigurationFilePath;

            if (string.IsNullOrWhiteSpace(portalConfigurationPath))
            {
                throw new ConfigurationErrorsException("WebPortalConfigurationPath setting not found in web.config");
            }

            IWebPortalConfigurationFactory webPortalConfigFactory = new WebPortalConfigurationFactory();

            ApplicationConfiguration.WebPortalConfigurationManager = webPortalConfigFactory.Create(portalConfigurationPath);

            var credentials = PartnerCredentials.Instance.GenerateByApplicationCredentials(
                ConfigurationManager.AppSettings["aad.applicationId"],
                ConfigurationManager.AppSettings["aad.applicationSecret"],
                ConfigurationManager.AppSettings["aad.applicationDomain"],
                ConfigurationManager.AppSettings["aad.authority"],
                ConfigurationManager.AppSettings["aad.graphEndpoint"]);

            this.Application["PartnerOperations"] = PartnerService.Instance.CreatePartnerOperations(credentials);
        }