Files
jizhi/backend/MiaoJiZhang.Infrastructure/Persistence/AppDbContextFactory.cs
T

18 lines
592 B
C#

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
namespace MiaoJiZhang.Infrastructure.Persistence;
public sealed class AppDbContextFactory : IDesignTimeDbContextFactory<AppDbContext>
{
public AppDbContext CreateDbContext(string[] args)
{
var options = new DbContextOptionsBuilder<AppDbContext>()
.UseMySql(
"Server=127.0.0.1;Database=miaoji_design;User=design;Password=design;",
new MySqlServerVersion(new Version(8, 0, 36)))
.Options;
return new AppDbContext(options);
}
}