using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
namespace Codex.Dal;
///
/// Factory for creating DbContext at design time (for migrations).
///
public class DesignTimeDbContextFactory : IDesignTimeDbContextFactory
{
public CodexDbContext CreateDbContext(string[] args)
{
var optionsBuilder = new DbContextOptionsBuilder();
// Use a default connection string for design-time operations
// This will be replaced by the actual connection string at runtime from appsettings.json
optionsBuilder.UseNpgsql("Host=localhost;Database=codex;Username=jean-philippe");
return new CodexDbContext(optionsBuilder.Options);
}
}