Beispiel #1
0
        /// <summary>
        /// The configuration.
        /// </summary>
        /// <param name="app">
        /// The app.
        /// </param>
        public void Configuration(IAppBuilder app)
        {
            var config = this.GetInjectionConfiguration();
            //  config.Services.Replace(typeof(System.Web.Http.ExceptionHandling.IExceptionHandler), new PassthroughException());
            BootstrapperWebApi bootstrapperWebApi = (BootstrapperWebApi)this.GetBootstrapperWebApi(config);

            bootstrapperWebApi.Initialize(true).EnableLogging().DisableWebApiDefaultExceptionHandler();

            //.EnableTransaction();

            /*var container = ServiceLocator.Instance.Current;
             * container.RegisterInterceptors();*/

            MappingConfig.RegisterMapping();
            ////WebApiODataConfig.Register(config); //ToDo we will uncomment this again when OData is not supported in web api
            WebApiConfig.Register(config);

            //SecurityConfig.Register(app, bootstrapperWebApi.DependencyResolver);
            //SecurityConfig.RegisterRequestThrottling(app, bootstrapperWebApi.DependencyResolver);
            app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);


            app.UseDependencyInjectorMiddleware(bootstrapperWebApi.DependencyResolver);

            app.UseCorrelationIdInjector();

            app.UseRequestMiddleware();

            app.UseOwinExceptionHandler <ApiExceptionConfiguration>();

            DbInitializer dbInitializer = bootstrapperWebApi.DependencyResolver.Resolve <DbInitializer>();

            Database.SetInitializer <CardValidationContext>(dbInitializer);
            //AutoMapperConfig.RegisterMappings();

            this.ConfigurationExtension(config, bootstrapperWebApi.DependencyResolver);

            var handler = bootstrapperWebApi.DependencyResolver.Resolve <RequestHandler>();

            config.MessageHandlers.Add(handler);

            app.UseUnityWebApi(config);

            app.UseWebApi(config);

            SetConfigurationFromAppSettings();
        }
Beispiel #2
0
        /// <summary>
        /// The get bootstrapper web api.
        /// </summary>
        /// <param name="config">
        /// The config.
        /// </param>
        /// <returns>
        /// The <see cref="IBootstrapper"/>.
        /// </returns>
        public virtual IBootstrapper GetBootstrapperWebApi(HttpConfiguration config)
        {
            var boostStrapperWebApi = new BootstrapperWebApi(config);

            return(boostStrapperWebApi);
        }
Beispiel #3
0
 /// <summary>
 ///     The get bootstrapper web api.
 /// </summary>
 /// <param name="config">
 ///     The config.
 /// </param>
 /// <returns>
 ///     The <see cref="IBootstrapper" />.
 /// </returns>
 public override IBootstrapper GetBootstrapperWebApi(HttpConfiguration config)
 {
     BootstrapperWebApi = new BootstrapperWebApi(config);
     return(BootstrapperWebApi);
 }