- Microsoft.EntityFrameworkCore.SqlServer -> Npgsql.EntityFrameworkCore.PostgreSQL 10.0.2 - UseSqlServer -> UseNpgsql (Aspire-injected gerbilmanager connection) - Removed hardcoded sa connection strings from appsettings*.json - Deleted SqlServer-flavored initial migration (fresh Npgsql one follows; no prod data) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
34 lines
823 B
C#
34 lines
823 B
C#
using GerbilManagerWebAPI.DAL;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
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();
|
|
builder.Services.AddDbContext<ApplicationContext>(opts => opts.UseNpgsql(builder.Configuration.GetConnectionString("gerbilmanager")));
|
|
builder.Services.AddScoped<UnitOfWork>();
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (app.Environment.IsDevelopment())
|
|
{
|
|
app.UseSwagger();
|
|
app.UseSwaggerUI();
|
|
}
|
|
|
|
if (app.Environment.IsDevelopment())
|
|
{
|
|
app.UseHttpsRedirection();
|
|
}
|
|
|
|
app.UseAuthorization();
|
|
|
|
app.MapControllers();
|
|
|
|
app.Run();
|