public void Configure(IApplicationBuilder app) { ApiConfiguration.Configure(app); app.UseAuthentication(); app.UseMvc(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { ApiConfiguration.Configure(app); app.UseStaticFiles() .UseAuthentication() .UseMvc(); }
public void ConfigureServices(IServiceCollection services) { services.AddSingleton <IConfiguration>(_configuration); services.AddMvc(); services.AddMemoryCache(); ApiConfiguration.Configure(services); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } ApiConfiguration.Configure(app); }
public void Configure(IApplicationBuilder app) { ApiConfiguration.Configure(app, host => { host.UseAuthentication(); return(host); }); }
public void ConfigureServices(IServiceCollection services) { services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(); services.AddControllers() .AddApplicationPart(Assembly.Load(new AssemblyName("Sample.Api"))); ApiConfiguration.Configure(services); }
public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseCors(AllowedOrigins) .UseUnitOfWork(); ApiConfiguration.Configure(app, host => { host.UseOpenApi(); return(host); }); }
public void Configure( IApplicationBuilder app, IWebHostEnvironment env, IApiVersionDescriptionProvider apiVersion) { ApiConfiguration.Configure( app, preConfigure: pre => pre .AddIf(env.IsDevelopment(), x => x.UseDeveloperExceptionPage()) .UseOpenApi(apiVersion), postConfigure: post => post); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApiVersionDescriptionProvider provider) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); } ApiConfiguration.Configure(app, provider); }
private static HttpConfiguration BuidHttpConfiguration(IContainer container) { // Create HttpConfiguration var config = new HttpConfiguration { DependencyResolver = new AutofacWebApiDependencyResolver(container) }; // Configure common options ApiConfiguration.Configure(config); // Overriden configurations config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always; return(config); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { ApiConfiguration.Configure(app, host => host .UseIf(env.IsDevelopment(), appBuilder => appBuilder.UseDeveloperExceptionPage()) .UseSwagger() .UseIf(env.IsDevelopment(), appBuilder => appBuilder.UseSwaggerUI(setup => { setup.SwaggerEndpoint("/swagger/v1/swagger.json", nameof(TrisvagoHotels)); })) .UseHttpsRedirection() .UseCustomHealthchecks() .UseRouting() .UseCors("CorsApi") .UseHeaderDiagnostics() .UseHealthChecksUI() .UseResponseCompression() ); }
private static HttpConfiguration BuidHttpConfiguration(IContainer container, IAppBuilder app) { // Create HttpConfiguration var config = new HttpConfiguration { DependencyResolver = new AutofacWebApiDependencyResolver(container) }; // Add policy based authorization app.UseAuthorization(Policies.Configure); // Configure common options ApiConfiguration.Configure(config); // Overriden configurations config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always; return(config); }
/// TODO GitHubIssue#51 : Support model lazy loading /// <summary> /// Maps the API routes to the RestierController. /// </summary> /// <typeparam name="TApi">The user API.</typeparam> /// <param name="config">The <see cref="HttpConfiguration"/> instance.</param> /// <param name="routeName">The name of the route.</param> /// <param name="routePrefix">The prefix of the route.</param> /// <param name="apiFactory">The callback to create API instances.</param> /// <param name="batchHandler">The handler for batch requests.</param> /// <returns>The task object containing the resulted <see cref="ODataRoute"/> instance.</returns> public static Task <ODataRoute> MapRestierRoute <TApi>( this HttpConfiguration config, string routeName, string routePrefix, Func <ApiBase> apiFactory, RestierBatchHandler batchHandler = null) where TApi : ApiBase { Ensure.NotNull(apiFactory, "apiFactory"); // ApiBase.ConfigureApi is called before this method is called. ApiConfiguration.Configure <TApi>(services => { services.AddScoped <RestierQueryExecutorOptions>() .ChainPrevious <IQueryExecutor, RestierQueryExecutor>(); }); using (var api = apiFactory()) { var model = api.GetModelAsync().Result; var conventions = CreateRestierRoutingConventions(config, model, apiFactory); if (batchHandler != null && batchHandler.ApiFactory == null) { batchHandler.ApiFactory = apiFactory; } var route = config.MapODataServiceRoute( routeName, routePrefix, model, new DefaultODataPathHandler(), conventions, batchHandler); // Customized converter should be added in ConfigureApi as service var converter = api.Context.GetApiService <ODataPayloadValueConverter>(); if (converter == null) { converter = new RestierPayloadValueConverter(); } model.SetPayloadValueConverter(converter); return(Task.FromResult(route)); } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { ApiConfiguration.Configure(app, host => { if (env.IsDevelopment()) { host.UseDeveloperExceptionPage(); } else { host.UseHsts(); } host.UseHttpsRedirection(); host.UseAuthentication(); host.UseCors(); host.UseStaticFiles(); return(host); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app) { ApiConfiguration.Configure(app); }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { ApiConfiguration.Configure(app, env) .UseRouting() .UseEndpoints(endpoints => endpoints.MapControllers()); }