public void Configuration(IAppBuilder app)
        {
            LogConfigurator.ConfigureForWeb(Assembly.GetExecutingAssembly().GetName().Name);

            Log.Information("Application_Start");
            ConfigureSecurity(app);

            UpgradeDb();
            CleanUpDb();

            AreaRegistration.RegisterAllAreas();

            GlobalConfiguration.Configure(cfg =>
            {
                cfg.Services.Add(typeof(IExceptionLogger), new CustomExceptionLogger());
                cfg.Services.Replace(typeof(IExceptionHandler), new CustomExceptionHandler());
                ODataConfig.Register(cfg);
                WebApiConfig.Register(cfg);
            });

            WebConfig.Configure();

            BundleConfig.RegisterBundles(BundleTable.Bundles);

            JsonConvert.DefaultSettings = () => new JsonSerializerSettings
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };

            RoutingHelper.Initialize();
        }
Esempio n. 2
0
        public void Configuration(IAppBuilder app)
        {
            LogConfigurator.ConfigureForWeb(Assembly.GetExecutingAssembly().GetName().Name);

            Log.Information("Application_Start");

            ConfigureSecurity(app);

            app.UseSwaggerUi3(new[] { typeof(ExternalController) }, settings =>
            {
                settings.GeneratorSettings.DefaultUrlTemplate = "api/{controller}/{action}/{id?}";
                settings.GeneratorSettings.Title       = "Viaduc REST API";
                settings.GeneratorSettings.Description = @"The API lets you search the Swiss Federal Archives.";
                settings.GeneratorSettings.Version     = "1.0";
                settings.PostProcess = doc =>
                {
                    doc.Servers.Clear();
                    doc.Servers.Add(new OpenApiServer
                    {
                        // Basis-URL der Doku auf BAR-Umgebungen stimmen sonst nicht
                        Url = WebHelper.SwaggerBaseUrl
                    });
                };
                settings.GeneratorSettings.SerializerSettings = new JsonSerializerSettings
                {
                    ContractResolver = new CamelCasePropertyNamesContractResolver()
                };
            }, new SwaggerJsonSchemaGenerator(new JsonSchemaGeneratorSettings()));


            BusConfig.Configure(NinjectWebCommon.Kernel);
            AreaRegistration.RegisterAllAreas();

            GlobalConfiguration.Configure(cfg =>
            {
                cfg.Services.Add(typeof(IExceptionLogger), new CustomExceptionLogger());
                cfg.Services.Replace(typeof(IExceptionHandler), new CustomExceptionHandler());
                WebApiConfig.Register(cfg);
            });

            WebConfig.Configure();
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            JsonConvert.DefaultSettings = () => new JsonSerializerSettings
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };

            RoutingHelper.Initialize();
        }