Add project files.
This commit is contained in:
34
DXApp.TemplateKitProject/Program.cs
Normal file
34
DXApp.TemplateKitProject/Program.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using DXApp.TemplateKitProject.Data;
|
||||
using DXApp.TemplateKitProject.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services.AddRazorPages();
|
||||
|
||||
// Datenbank
|
||||
var connectionString = builder.Configuration.GetConnectionString("EcmContext")
|
||||
?? throw new InvalidOperationException("Connection string 'EcmContext' not found.");
|
||||
builder.Services.AddDbContext<AppDbContext>(options =>
|
||||
options.UseSqlServer(connectionString));
|
||||
|
||||
// Services
|
||||
builder.Services.AddScoped<PdfAttachmentExtractorService>();
|
||||
builder.Services.AddScoped<ZugferdExtractorService>();
|
||||
builder.Services.AddScoped<ZugferdParserService>();
|
||||
builder.Services.AddScoped<ZugferdImportService>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseExceptionHandler("/Error");
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseStaticFiles();
|
||||
app.UseRouting();
|
||||
app.UseAuthorization();
|
||||
app.MapRazorPages();
|
||||
app.Run();
|
||||
Reference in New Issue
Block a user