Beispiel #1
0
        public void Configuration(IAppBuilder app)
        {
            Container = new Container();
            // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=316888
            RegisterInstances();
            HttpConfiguration configuration = new HttpConfiguration();

            configuration.Services.Replace(typeof(IExceptionHandler), new GlobalExceptionHandler.ExceptionHandler());
            configuration.MapHttpAttributeRoutes();
            SwaggerConfig.Register(configuration);

            app.UseWebApi(configuration);
        }
Beispiel #2
0
        public void Configuration(IAppBuilder app)
        {
            Container = new Container();
            Container.Options.DefaultScopedLifestyle = new AsyncScopedLifestyle();
            // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=316888
            RegisterInstances();
            HttpConfiguration configuration = new HttpConfiguration();

            configuration.Services.Replace(typeof(IExceptionHandler), new GlobalExceptionHandler.ExceptionHandler());

            configuration.MapHttpAttributeRoutes();
            configuration.Filters.Add(new RequestFilterAttribute());
            SwaggerConfig.Register(configuration);
            Container.RegisterWebApiControllers(configuration);
            configuration.DependencyResolver = new SimpleInjectorWebApiDependencyResolver(Container);

            app.Use <AuthMiddleware>(new AuthManager(new AuthOption()));
            //Task.Factory.StartNew(MatchStatusChanger);
            app.UseCors(CorsOptions.AllowAll);
            app.UseWebApi(configuration);
        }