Files
2024-12-29 17:57:58 +01:00

41 lines
891 B
C#

using Microsoft.EntityFrameworkCore;
using Server.Repository;
using System.Reflection;
using Server.Models;
using Microsoft.Extensions.DependencyInjection.Extensions;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
// Alle Klassen registrieren
builder.Services.AddTransient<Game>();
builder.Services.AddScoped<IGameRepository, GameRepository>();
builder.Services.AddDbContext<ApplicationDbContext>();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();