using ApiSoftway.Models.Gesa_DbContext; using ApiSoftway.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.OpenApi.Models; var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddControllers(); const int commandTimeoutInSeconds = 300; #region Istaze Dbcontext builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("ApiStr") , options => { options.CommandTimeout(commandTimeoutInSeconds); } )); builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA") , options => { options.CommandTimeout(commandTimeoutInSeconds); } )); builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA") , options => { options.CommandTimeout(commandTimeoutInSeconds); } )); builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA") , options => { options.CommandTimeout(commandTimeoutInSeconds); } )); builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA") , options => { options.CommandTimeout(commandTimeoutInSeconds); } )); builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA") , options => { options.CommandTimeout(commandTimeoutInSeconds); } )); builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA") , options => { options.CommandTimeout(commandTimeoutInSeconds); } )); builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA") , options => { options.CommandTimeout(commandTimeoutInSeconds); } )); builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA") , options => { options.CommandTimeout(commandTimeoutInSeconds); } )); builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA") , options => { options.CommandTimeout(commandTimeoutInSeconds); } )); builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA") , options => { options.CommandTimeout(commandTimeoutInSeconds); } )); builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA") , options => { options.CommandTimeout(commandTimeoutInSeconds); } )); builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA") , options => { options.CommandTimeout(commandTimeoutInSeconds); } )); builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA") , options => { options.CommandTimeout(commandTimeoutInSeconds); } )); builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA") , options => { options.CommandTimeout(commandTimeoutInSeconds); } )); builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA") , options => { options.CommandTimeout(commandTimeoutInSeconds); } )); builder.Services.AddDbContext(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA") , options => { options.CommandTimeout(commandTimeoutInSeconds); } )); #endregion // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(gen => { gen.ResolveConflictingActions(apiDescription => apiDescription.First()); //gen.SwaggerDoc("v1", new OpenApiInfo { Title = "POLO API WS2016", Version = "v3.3" }); DateTime oggi = DateTime.Now; string dt = oggi.ToString(); gen.SwaggerDoc("v1", new OpenApiInfo { Title = "GESA API - v.app 1.1", Version = dt }); }); builder.Services.AddLogging(opt => { opt.AddConsole(c => { c.TimestampFormat = "[yyyy-MM-dd HH:mm:ss] "; }); }); var app = builder.Build(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment() || app.Environment.IsProduction()) { app.UseSwagger(); app.UseSwaggerUI(); } //app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.MapControllers(); //app.Run(); app.Run("http://localhost:6000");