Exemple #1
0
        private static HttpConfiguration BuildHttpConfiguration(PiercerSettings settings)
        {
            var configuration = new HttpConfiguration();

            configuration.Services.Replace(typeof(IAssembliesResolver), new WebApiAssembliesResolver());
            configuration.MapHttpAttributeRoutes();
            configuration.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;

            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterInstance(settings);
            containerBuilder.RegisterSource(new AnyConcreteTypeNotAlreadyRegisteredSource());

            configuration.DependencyResolver = new AutofacWebApiDependencyResolver(containerBuilder.Build());

            return(configuration);
        }
Exemple #2
0
 public PiercerController(PiercerSettings settings)
 {
     this.settings = settings;
 }
Exemple #3
0
 public PiercerController(PiercerSettings settings)
 {
     this.settings = settings;
 }
Exemple #4
0
        /// <summary>
        ///     Creates the OWIN mid-func needed to hook the query host Web API into an existing OWIN pipeline.
        /// </summary>
        public static IAppBuilder UsePiercer(this IAppBuilder appBuilder, PiercerSettings settings)
        {
            appBuilder.Use(Middleware.Create(settings));

            return appBuilder;
        }
Exemple #5
0
        public static Func <Func <IDictionary <string, object>, Task>, Func <IDictionary <string, object>, Task> > Create(PiercerSettings settings)
        {
            return(next =>
            {
                var appBuilder = new AppBuilder();

                HttpConfiguration configuration = BuildHttpConfiguration(settings);

                EnableSwagger(configuration);

                appBuilder.Map(settings.Route, a => a.UseWebApi(configuration));
                appBuilder.Run(ctx => next(ctx.Environment));

                return appBuilder.Build();
            });
        }
Exemple #6
0
        /// <summary>
        ///     Creates the OWIN mid-func needed to hook the query host Web API into an existing OWIN pipeline.
        /// </summary>
        public static IAppBuilder UsePiercer(this IAppBuilder appBuilder, PiercerSettings settings)
        {
            appBuilder.Use(Middleware.Create(settings));

            return(appBuilder);
        }