53 lines
1.4 KiB
C#
53 lines
1.4 KiB
C#
using System.Globalization;
|
|
using System.Reflection;
|
|
using AfRApay.Web.Backend.Database;
|
|
using Microsoft.AspNetCore.Localization;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Swashbuckle.AspNetCore.Filters;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
builder.Services.AddRazorPages();
|
|
builder.Services.AddSwaggerGen(options => {
|
|
var xmlFilename = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
|
|
options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename));
|
|
options.ExampleFilters();
|
|
});
|
|
builder.Services.AddSwaggerExamplesFromAssemblies(Assembly.GetEntryAssembly());
|
|
|
|
#if (DEBUG)
|
|
builder.Services.AddDatabaseDeveloperPageExceptionFilter();
|
|
builder.Services.AddControllers().AddRazorRuntimeCompilation();
|
|
builder.Services.AddControllers();
|
|
#else
|
|
builder.Services.AddControllers();
|
|
#endif
|
|
|
|
var app = builder.Build();
|
|
|
|
var culture = new CultureInfo("de-DE") { NumberFormat = { NumberDecimalSeparator = ".", CurrencyDecimalSeparator = "." } };
|
|
|
|
app.UseRequestLocalization(options => {
|
|
options.DefaultRequestCulture = new RequestCulture(culture);
|
|
options.SupportedCultures = new List<CultureInfo> { culture };
|
|
});
|
|
|
|
if (app.Environment.IsDevelopment()) {
|
|
app.UseSwagger();
|
|
app.UseSwaggerUI();
|
|
}
|
|
|
|
app.UseStatusCodePagesWithReExecute("/Error");
|
|
|
|
app.UseStaticFiles();
|
|
|
|
app.UseRouting();
|
|
app.UseAuthorization();
|
|
|
|
app.MapRazorPages();
|
|
app.MapControllers();
|
|
|
|
new DatabaseContext().Database.Migrate();
|
|
|
|
app.Run();
|