using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; using Pomelo.EntityFrameworkCore.MySql.Infrastructure; using Pomelo.EntityFrameworkCore.MySql.Storage; using System; using System.Collections.Generic; using System.Text; using dotenv.net; using System.IO; namespace Kehyeedra3 { class ApplicationDbContextFactory : IDesignTimeDbContextFactory { public ApplicationDbContext CreateDbContext(string[] args = null) { DotEnv.Config(filePath: Path.Combine(AppContext.BaseDirectory, ".env")); var optionsBuilder = new DbContextOptionsBuilder(); optionsBuilder.UseMySql(Environment.GetEnvironmentVariable("KEHYEEDRA_CONNSTR"), x => { x.EnableRetryOnFailure(); x.CharSet(CharSet.Utf8Mb4); }); return new ApplicationDbContext(optionsBuilder.Options); } } }