Esempio n. 1
0
        // See LocatorStartup for lots of pre-startup IoC setup that's performed.

        public void Configuration(IAppBuilder app)
        {
            var appSettings = LocatorStartup.Locator.GetInstance <ApplicationSettings>();

            app.Use <InstallCheckMiddleware>(appSettings);

            // Register the "/Attachments/" route handler. This needs to be called before the other routing setup.
            if (appSettings.Installed)
            {
                // InstallService.Install also performs this
                var fileService = LocatorStartup.Locator.GetInstance <IFileService>();
                AttachmentRouteHandler.RegisterRoute(appSettings, RouteTable.Routes, fileService);
            }

            // Filters
            GlobalFilters.Filters.Add(new HandleErrorAttribute());

            // Areas are used for Site settings (for a cleaner view structure)
            // This should be called before the other routes, for some reason.
            AreaRegistration.RegisterAllAreas();

            // Register routes
            Routing.RegisterApi(GlobalConfiguration.Configuration);
            Routing.Register(RouteTable.Routes);

            // Custom view engine registration (to add directory search paths for Theme views)
            ExtendedRazorViewEngine.Register();

            app.UseWebApi(new HttpConfiguration());


            Log.Information("Application started");
        }
Esempio n. 2
0
        protected void Application_Start()
        {
            // Get the settings from the web.config
            ConfigReaderWriter  configReader        = new FullTrustConfigReaderWriter("");
            ApplicationSettings applicationSettings = configReader.GetApplicationSettings();

            // Configure StructureMap dependencies
            DependencyManager iocSetup = new DependencyManager(applicationSettings);

            iocSetup.Configure();
            iocSetup.ConfigureMvc();

            // Logging
            Log.ConfigureLogging(applicationSettings);

            // Filters
            GlobalFilters.Filters.Add(new HandleErrorAttribute());

            // Areas are used for:
            // - Site settings (for a cleaner view structure)
            // - Webapi help.
            // This should be called before the other routes, for some reason.
            AreaRegistration.RegisterAllAreas();

            // Register routes and JS/CSS bundles
            Routing.RegisterApi(GlobalConfiguration.Configuration);
            Routing.Register(RouteTable.Routes);
            Bundles.Register();

            // Custom view engine registration (to add new search paths)
            ExtendedRazorViewEngine.Register();

            Log.Information("Application started");
        }