jia*_*756 6 c# entity-framework-core asp.net-core
.net 核心 3.0。我有一个 LibraryProject(SyWaterStandardLibrary),有一个 DbContext。当我构建新的 WebProject(WebApplicationTestLibrary) 并使用 LibraryProject 时。
启动:
services.AddDbContext<LocalContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("SMS"),
optionsBuilder => optionsBuilder.MigrationsAssembly("WebApplicationTestLibrary"))
);
Run Code Online (Sandbox Code Playgroud)
当我执行: add-migration init -context localcontext
发生错误:您的目标项目“WebApplicationTestLibrary”与您的迁移程序集“SyWaterStandardLibrary”不匹配。更改您的目标项目或更改您的迁移程序集。
.net core 2.2 中不存在此异常。请问怎么回事。
Mét*_*ule 15
当您从 Visual Studio 中的包管理器控制台运行任何 Entity Framework Core 命令时,默认项目必须是您的迁移程序集SyWaterStandardLibrary。这是一张显示如何更改它的图片(这里,我的迁移程序集称为Model):
请注意,这与启动项目不同。
| 归档时间: |
|
| 查看次数: |
6524 次 |
| 最近记录: |