1
0
mirror of https://github.com/chylex/Minecraft-Phantom-Panel.git synced 2024-12-22 16:42:50 +01:00
Minecraft-Phantom-Panel/Controller/Phantom.Controller.Database.Postgres/ApplicationDbContextDesignFactory.cs

16 lines
588 B
C#

using System.Reflection;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
namespace Phantom.Controller.Database.Postgres;
public sealed class ApplicationDbContextDesignFactory : IDesignTimeDbContextFactory<ApplicationDbContext> {
public ApplicationDbContext CreateDbContext(string[] args) {
var options = new DbContextOptionsBuilder<ApplicationDbContext>()
.UseNpgsql(static options => options.MigrationsAssembly(Assembly.GetExecutingAssembly().FullName))
.Options;
return new ApplicationDbContext(options);
}
}