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); }
public PiercerController(PiercerSettings settings) { this.settings = settings; }
/// <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; }
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(); }); }
/// <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); }