// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } //app.UseHttpsRedirection(); app.UseRouting(); AuthenticationExtension.Configure(app); CorsExtension.Configure(app); app.UseStaticFiles(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); SwaggerExtension.Configure(app); SignalRExtension.Configure(app); }
/// <summary> /// /// </summary> /// <param name="services"></param> public void ConfigureServices(IServiceCollection services) { SwaggerConfiguration.AddService(services); DbContextExtension.AddService(services, Configuration); CorsExtension.AddService(services); RouteExtension.AddService(services); RouteAnalyzerExtension.AddService(services); services.AddMemoryCache(); services.AddHttpContextAccessor(); services.AddSingleton <IActionContextAccessor, ActionContextAccessor>(); try { #pragma warning disable 618 AuthenticationConfiguration.AddService(services, Configuration); services.AddAutoMapper(); #pragma warning disable 618 } catch { } WebEncoderConfiguration.AddService(services); ValidateConfiguration.AddService(services); JsonExtension.AddService(services); SetCompatibilityVersionExtension.AddService(services); }
public void ConfigureServices(IServiceCollection services) { services.AddControllers(); services.InjectBusinessLogicDependency(Configuration); CorsExtension.Add(services); }
public void ConfigureServices(IServiceCollection services) { services.InjectBusinessLogicDependency(Configuration); AuthenticationExtension.Add(services, Configuration); CorsExtension.Add(services); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { DependencyInjectionExtension.ConfigureService(services); CorsExtension.ConfigureService(services); AuthenticationExtension.ConfigureService(services); MediatRExtension.ConfigureService(services); SwaggerExtension.ConfigureService(services); ControllersExtension.ConfigureService(services); SignalRExtension.ConfigureService(services); }
/// <summary> /// /// </summary> /// <param name="app"></param> /// <param name="env"></param> // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { SwaggerConfiguration.AddConfigure(app); AuthenticationConfiguration.AddConfigure(app); DevelopmentConfiguration.AddConfigure(app, env); app.UseStaticFiles(); app.UseFileServer(); CorsExtension.AddConfigure(app); ExceptionConfiguration.AddConfigure(app); var serviceProvider = app.ApplicationServices; var httpContextAccessor = serviceProvider.GetRequiredService <IHttpContextAccessor>(); AuthenticationContextService.AddConfigure(httpContextAccessor); RouteExtension.AddConfigure(app); RouteAnalyzerExtension.AddConfigure(app); }
public static IServiceCollection AddWebApiForIntegrationTest(this IServiceCollection services, WebApiExtensionConfig config) { ApiVersioningExtension.AddApiVersioning(services); VersionedApiExplorerExtension.AddVersionedApiExplorer(services); CorsExtension.AddCors(services); services .AddJwtAuthentication(config.AuthenticationExtensionConfig) .AddAuthorizationForIntegrationTest(config.AuthorizationExtensionConfig) .AddAutoMapper(config.AutoMapperAssemblies) .AddCommunicationBus(config.StartupAssembly) .AddMvcCore(config.Environment, config.StartupAssembly) .AddSwagger(config.SwaggerExtensionConfig); services.AddSingleton <Core.Mapper.IMapper, Infrastructure.Mapper.Mapper>(); services.AddSingleton <ILogger, Logger>(); services.AddSingleton(typeof(IOrderByExpressionCreator <>), typeof(OrderByExpressionCreator <>)); return(services); }