public virtual void Configure(IApplicationBuilder AApplication, AppUrls AAppUrls) { AApplication.UseSerilogRequestLogging(); AApplication.UseExceptionHandler(ExceptionHandler.Handle); AApplication.UseMiddleware <CustomCors>(); AApplication.UseResponseCompression(); AApplication.UseHttpsRedirection(); AApplication.UseStaticFiles(); AApplication.UseSpaStaticFiles(); AApplication.UseRouting(); if (FEnvironment.IsDevelopment()) { AApplication.UseSwagger(); AApplication.UseSwaggerUI(AOption => AOption.SwaggerEndpoint("/swagger/v1/swagger.json", "TokanPagesApi version 1")); } AApplication.UseEndpoints(AEndpoints => AEndpoints.MapControllers()); AApplication.UseSpa(ASpa => { ASpa.Options.SourcePath = "ClientApp"; if (FEnvironment.IsDevelopment()) { ASpa.UseProxyToSpaDevelopmentServer(AAppUrls.DevelopmentOrigin); } }); }
private static void SetupMediatR(IServiceCollection AServices) { AServices.AddMediatR(AOption => AOption.AsScoped(), typeof(TemplateHandler <IRequest, Unit>).GetTypeInfo().Assembly); AServices.AddScoped(typeof(IPipelineBehavior <,>), typeof(LoggingBehaviour <,>)); AServices.AddScoped(typeof(IPipelineBehavior <,>), typeof(FluentValidationBehavior <,>)); }
public virtual void ConfigureServices(IServiceCollection AServices) { AServices.AddMvc(); AServices.AddControllers(); AServices.AddSpaStaticFiles(AOptions => AOptions.RootPath = "ClientApp/build"); AServices.AddResponseCompression(AOptions => AOptions.Providers.Add <GzipCompressionProvider>()); Dependencies.Register(AServices, FConfiguration); if (FEnvironment.IsDevelopment()) { AServices.AddSwaggerGen(AOption => AOption.SwaggerDoc("v1", new OpenApiInfo { Title = "HotelCaliforniaApi", Version = "v1" })); } }
public void ConfigureServices(IServiceCollection AServices) { AServices.AddMvc(AOption => AOption.CacheProfiles .Add("Standard", new CacheProfile() { Duration = 10, Location = ResponseCacheLocation.Any, NoStore = false })); AServices.AddMvc(AOption => AOption.EnableEndpointRouting = false) .SetCompatibilityVersion(CompatibilityVersion.Version_3_0); AServices.AddControllers(); AServices.AddSingleton(Configuration.GetSection("CosmosDb").Get <CosmosDbSettings>()); AServices.AddScoped <ICosmosDbService, CosmosDbService>(); AServices.AddMediatR(Assembly.GetExecutingAssembly()); AServices.AddTransient <IRequestHandler <AddNewUserCommand, Unit>, AddNewUserCommandHandler>(); AServices.AddTransient <IRequestHandler <AddNewArticleCommand, Unit>, AddNewArticleCommandHandler>(); AServices.AddTransient <IRequestHandler <AddNewSubscriberCommand, Unit>, AddNewSubscriberCommandHandler>(); AServices.AddTransient <IRequestHandler <GetAllArticlesQuery, IEnumerable <Articles> >, GetAllArticlesQueryHandler>(); AServices.AddTransient <IRequestHandler <GetAllUsersQuery, IEnumerable <Users> >, GetAllUsersQueryHandler>(); AServices.AddTransient <IRequestHandler <GetAllSubscribersQuery, IEnumerable <Subscribers> >, GetAllSubscribersQueryHandler>(); AServices.AddTransient <IRequestHandler <GetSingleArticleQuery, Articles>, GetSingleArticleQueryHandler>(); AServices.AddTransient <IRequestHandler <GetSingleUserQuery, Users>, GetSingleUserQueryHandler>(); AServices.AddTransient <IRequestHandler <GetSingleSubscriberQuery, Subscribers>, GetSingleSubscriberQueryHandler>(); AServices.AddResponseCompression(AOptions => { AOptions.Providers.Add <GzipCompressionProvider>(); }); AServices.AddSwaggerGen(AOption => { AOption.SwaggerDoc("v1", new OpenApiInfo { Title = "Cosmos DB Example", Version = "v1" }); }); }
public void Configure(IApplicationBuilder AApplication, IWebHostEnvironment AEnvironment) { if (AEnvironment.IsDevelopment()) { AApplication.UseDeveloperExceptionPage(); } AApplication.UseSwagger(); AApplication.UseSwaggerUI(AOption => { AOption.SwaggerEndpoint("/swagger/v1/swagger.json", "Cosmos DB Example version 1"); }); AApplication.UseResponseCompression(); AApplication.UseStaticFiles(); AApplication.UseRouting(); AApplication.UseEndpoints(AEndpoints => { AEndpoints.MapControllers(); }); }
public OptionQuote(AOption eo) { Option = eo; }