添加项目文件。
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
using GroupService.Infrastructure;
|
||||
using IM.InitCommon;
|
||||
using Microsoft.EntityFrameworkCore.Design;
|
||||
|
||||
namespace ContactService.WebApi
|
||||
{
|
||||
public class DesignTimeDbContextFactory : IDesignTimeDbContextFactory<GroupDbContext>
|
||||
{
|
||||
public GroupDbContext CreateDbContext(string[] args)
|
||||
{
|
||||
// 1. 复用你写好的配置工厂,提取连接字符串
|
||||
var optionsBuilder = DbContextOptionsBuilderFactory.Create<GroupDbContext>();
|
||||
|
||||
// 2. 🌟 关键补刀:把假的 Mediator 传进去,满足构造函数的要求!
|
||||
return new GroupDbContext(optionsBuilder.Options, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user