66 lines
3.0 KiB
C#
66 lines
3.0 KiB
C#
using ApiSoftway.Models.Gesa_DbContext;
|
|
using ApiSoftway.Models;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add services to the container.
|
|
|
|
builder.Services.AddControllers();
|
|
const int commandTimeoutInSeconds = 300;
|
|
|
|
#region Istaze Dbcontext
|
|
builder.Services.AddDbContext<TOKEN_DbContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("ApiStr")
|
|
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
|
));
|
|
|
|
builder.Services.AddDbContext<GESA_PERSONALE_DbContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA")
|
|
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
|
));
|
|
builder.Services.AddDbContext<GESA_GIRI_DbContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA")
|
|
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
|
));
|
|
builder.Services.AddDbContext<GESA_DESTINAZIONI_DbContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA")
|
|
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
|
));
|
|
builder.Services.AddDbContext<GESA_CONSEGNE_DbContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA")
|
|
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
|
));
|
|
builder.Services.AddDbContext<GESA_CLIENTI_DbContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA")
|
|
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
|
));
|
|
builder.Services.AddDbContext<GESA_GIRICONSEGNE_DbContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA")
|
|
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
|
));
|
|
builder.Services.AddDbContext<GESA_GIRICONSEGNEVISTA_DbContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("GESA")
|
|
, options => { options.CommandTimeout(commandTimeoutInSeconds); }
|
|
));
|
|
builder.Services.AddDbContext<GESA_SBR_ORD_DbContext>(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();
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (app.Environment.IsDevelopment() || app.Environment.IsProduction())
|
|
{
|
|
app.UseSwagger();
|
|
app.UseSwaggerUI();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
app.UseAuthorization();
|
|
|
|
app.MapControllers();
|
|
|
|
//app.Run();
|
|
app.Run("http://localhost:6000");
|