refactor: Projektdateien migriert. Cloud-NuGet-Pakete durch lokale NuGet-Projekte ersetzt.

This commit is contained in:
Developer 02
2024-08-01 18:44:39 +02:00
parent 0d82f7af6f
commit 62ddd4873f
206 changed files with 10927 additions and 1 deletions

69
StaffDBServer/Startup.cs Normal file
View File

@@ -0,0 +1,69 @@
using DAL;
using HRD.LDAPService.JWT;
using HRD.WebApi;
using HRD.WebApi.DAL.Middleware;
using HRD.WebApi.Helpers;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using NLog.Web;
using StaffDBServer.Extends;
using StaffDBServer.SharedExtensions;
using System;
namespace StaffDBServer
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.ConfigureWebApiExtensionsAtFirst(); //at first
services.ConfigureRepositoryWrapper(); //add repos
services.AddDbContext<WebApiContext>(options =>
{
const int dbTimeoutInMin = 5;
options
.UseSqlServer(WebApiConfig.ConnectionString(EN_ConnectionType.SQLServer),
opts => opts.CommandTimeout((int)TimeSpan.FromMinutes(dbTimeoutInMin).TotalSeconds));
});
services.ConfigureWebApiExtensionsEnd(); //should come last
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.ApplicationServices.SetupNLogServiceLocator();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseHsts();
}
app.AddCustomExceptionHandling();
app.UseHttpsRedirection();
app.UseRouting();
app.UseCors("AllowAllOrigins");
app.UseOpenApi();
app.UseDALMiddleware();
app.UseJwtMiddleware();
app.ConfigureSwagger();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}