有人知道如何更改以下命令的输出目录吗?

dotnet ef  migrations add Initial --context EsportshubApi.Models.ApplicationDbContext

我试图添加以下选项:

--content-root-path 'Migrations/Identity' 

但那没什么用.还有一个--data-dir选项,还有一个目录选项.但这些都不是迁移的结果.

我的问题是我有2个DbContext,所以我希望将它们的迁移分开.

推荐答案

dotnet ef migrations add Initial --context EsportshubApi.Models.ApplicationDbContext -o YourFolderPath

dotnet ef migrations add

添加一个新的migrations.

参数:

Argument Description
<NAME> The name of the migration.

选项:

Option Short Description
--output-dir <PATH> -o The name of the migration.
--namespace <NAMESPACE> -n The namespace to use for the generated classes. Defaults to generated from the output directory. Added in EF Core 5.0.

这里还有您可以与此命令一起使用的common options.

Source

Asp.net相关问答推荐

在这个 For 循环计数没有增加

DBSet 不包含 Where 的定义

如何注册路由区域

在 DataTextField 中组合两个字段.这可能吗?

带有 Web 套接字的 SignalR

有条件地在 Gridview 中隐藏 CommandField 或 ButtonField

ASP.NET:获取自 1970 年 1 月 1 日以来的毫秒数

使用 Owin 身份验证的服务器端声明缓存

如何通过后面的代码不显示

无法确定条件表达式的类型,因为 'string' 和 'System.DBNull' 之间没有隐式转换

如何设置 CSS 切换器

ASP .NET Button 事件处理程序不会在第一次单击时触发,而是在 PostBack 后的第二次单击时触发

如何从 Web API 应用程序返回 PDF

导航到本地 IIS Express 时,Chrome 会返回错误请求 - 请求太长

HttpContext.Current.Request.Url.Host 它返回什么?

避免在 ASP.NET MVC 中使用会话状态是一种好习惯吗?如果是,为什么以及如何?

解耦 ASP.NET MVC 5 标识以允许实现分层应用程序

IronRuby死了吗?

ConfigurationManager.AppSettings 缓存

如何使用 int ID 列更改 ASP.net Identity 2.0 的表名?