system-praktyk-api/src/InternshipSystem.Repository/InternshipDbContextFactory.cs

18 lines
592 B
C#

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
namespace InternshipSystem.Repository {
public class InternshipDbContextFactory : IDesignTimeDbContextFactory<InternshipDbContext>
{
public InternshipDbContext CreateDbContext(string[] args)
{
var optionsBulider = new DbContextOptionsBuilder<InternshipDbContext>();
optionsBulider.UseNpgsql("Host=localhost;Port=5432;Database=postgres;Username=postgres;Password=szwoniu");
return new InternshipDbContext(optionsBulider.Options);
}
}
}