feat(API): Cookie-basierter Lokalisierer hinzugefügt.

This commit is contained in:
Developer 02 2024-10-25 10:54:06 +02:00
parent f2ab2a9759
commit ef91358c96

View File

@ -3,6 +3,7 @@ using DigitalData.UserManager.Application;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using WorkFlow.Infrastructure; using WorkFlow.Infrastructure;
using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Authentication.Cookies;
using DigitalData.Core.API;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
var config = builder.Configuration; var config = builder.Configuration;
@ -11,6 +12,7 @@ var config = builder.Configuration;
var cnn_str = config.GetConnectionString("Default") ?? throw new ("Default connection string not found."); var cnn_str = config.GetConnectionString("Default") ?? throw new ("Default connection string not found.");
builder.Services.AddDbContext<WFDBContext>(options => options.UseSqlServer(cnn_str).EnableDetailedErrors()); builder.Services.AddDbContext<WFDBContext>(options => options.UseSqlServer(cnn_str).EnableDetailedErrors());
builder.Services.AddWorkFlow().AddUserManager<WFDBContext>(); builder.Services.AddWorkFlow().AddUserManager<WFDBContext>();
builder.Services.AddCookieBasedLocalizer();
builder.Services.AddControllers(); builder.Services.AddControllers();
@ -42,6 +44,8 @@ app.UseAuthentication();
app.UseAuthorization(); app.UseAuthorization();
app.UseCookieBasedLocalizer("de-DE");
app.MapControllers(); app.MapControllers();
app.Run(); app.Run();