c# - VS Code 中的实体框架迁移
问题描述
我在 Visual Studio 中应用了 EF 迁移,但我无法通过 VS Code 应用它们。
1.以下脚本有什么问题?
dotnet ef migrations enable-migrations -ContextTypeName Demo.ApplicationDbContext -MigrationsDirectory:Migrations
dotnet ef migrations Add-Migration -configuration Demo.Migrations.Configuration Migration_Initial
dotnet ef migrations Update-Database -configuration Demo.Migrations.Configuration
2. VS Code 中是否有类似 PM Console 的功能?
3.除了 VS Code Treminal 或 CLI 之外,我还可以通过 cmd 应用这些脚本吗?
解决方案
在 VS Code 中,您可以在终端窗口中使用 CLI 或 powershell。这些命令的语法略有不同。看起来您在示例中混合了 powershell 语法和 CLI 语法。例如,对于添加迁移,CLI 语法是
dotnet ef migrations add Migration_Initial --configuration Demo.Migrations.Configuration
推荐阅读
- r - 计算R中多个向量之间的欧几里得距离
- entity-framework - 如何在 ASP.NET Core 中加载具有多对多关系的数据?
- python - Python多处理'NoneType'对象没有属性'split'
- python - Python 3 从最后一个特定字符切分字符串
- sml - 如何遍历模式并返回所有字符串的列表
- java - 我在 openshift 服务中看不到 Docker 映像
- php - 如何修复:无法加载动态库 'C:\Program Files\php\ext\php_imagick.dll' - 在第 0 行的未知中找不到指定的模块?
- google-cloud-platform - 防止存储桶公开
- html - CSS translate 属性在 Chrome 上中断,但在 Firefox 中显示完美
- typescript - 从 Redux Toolkit 的 createSlice 获取操作类型