如何使用asp.net Core更改输出文件夹以进行迁移? [英] How to change the output folder for migrations with asp.net Core?
问题描述
有人知道如何更改以下命令的输出目录吗?
Does anyone know how to change the output directory of the following command?
dotnet ef migrations add Initial --context EsportshubApi.Models.ApplicationDbContext
我尝试添加选项:
--content-root-path 'Migrations/Identity'
但是那什么也没做.也有一个--data-dir
选项,目录还有其他内容.但是它们都不是迁移的输出.
But that doesn't do anything. There is a --data-dir
option as well and something else with directory. But none of them is the output for migrations.
我的问题是我有2个DbContext,所以我希望将它们的迁移分开.
My problem is that I have 2 DbContexts so I want their migrations to be separated.
推荐答案
dotnet ef migrations add Initial --context EsportshubApi.Models.ApplicationDbContext -o YourFolderPath
dotnet ef迁移添加
添加新的迁移.
dotnet ef migrations add
Adds a new migration.
参数:
< NAME> 迁移的名称.
< NAME > The name of the migration.
选项:
-o --output-dir<路径> 要使用的目录(和子命名空间).路径是相对于项目目录的.默认为迁移".
-o --output-dir < PATH > The directory (and sub-namespace) to use. Paths are relative to the project directory. Defaults to "Migrations".
这篇关于如何使用asp.net Core更改输出文件夹以进行迁移?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!