- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我将所有 ef 代码首先迁移到一个名为 Migrations
的单独程序集中。
在包管理器控制台中,我输入 Add-Migration xyz
这支撑了迁移
是否可以从 Visual Studio 外部执行此操作?我正在使用 rake 脚本为我的构建进行大量自动化,但这是我还没有完全掌握的部分。这里的目标是执行以下操作rake db:add_migration "xyz"
这将运行一些命令并将迁移添加到指定的项目。这是我唯一无法弄清楚如何自动化的地方!我可能会构建其他任务,例如删除和创建数据库以及将迁移导出到脚本,以便它可以在我的回旋迁移下运行。
相关资料
Add-Migration [-Name] <String> [-Force]
[-ProjectName <String>] [-StartUpProjectName <String>]
[-ConfigurationTypeName <String>] [-ConnectionStringName <String>]
[-IgnoreChanges] [<CommonParameters>]
packages\EntityFramework.5.0.0\tools
EntityFramework.psm1
function Add-Migration
{
[CmdletBinding(DefaultParameterSetName = 'ConnectionStringName')]
param (
[parameter(Position = 0,
....
}
..\packages\EntityFramework.5.0.0\tools>powershell EntityFramework.psm1 Add-Migration
The term 'EntityFramework.psm1' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name,
or if a path was included, verify that the path is correct and try again.
At line:1 char:21
+ EntityFramework.psm1 <<<< Add-Migration
+ CategoryInfo : ObjectNotFound: (EntityFramework.psm1:String) [],
CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
最佳答案
查看 EntityFramework.psm1
它只是 EntityFramework.PowerShell.dll 的脚本外观。实际的添加迁移功能在 System.Data.Entity.Migrations.AddMigrationCommand
中实现。在那个程序集中上课。
查看源代码,它通过以下行获取当前事件的项目(我假设这是在 powershell 控制台中选择的项目):
get { return (Project)_domain.GetData("project"); }
Project
是
EnvDTE.Project
这(如果我正确地用谷歌搜索的话)是一种与 IDE 交互的方式。一些进一步的源代码阅读表明,文件是通过与 IDE 接口(interface)添加到项目中的。
EntityFramework.PowerShell.dll
周围编写一个自己的 .exe 包装器。如果在调用
AddMigrationCommand
之前应用程序域已准备好正确的 EnvDTE 对象类(class)。为此,您必须分析 Entity Framework 源代码,以了解如何欺骗脚手架代码以相信它在 Visual Studio 内部运行。
关于entity-framework - 将 EF Add-Migration 脚本编写到自动构建任务中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17093288/
因此,我正在使用 rails(ruby 1.9.3p392、rails 3.2、sqlite3 db)并尝试将无处不在的博客教程代码部署到“生产”服务器(apache、passenger、ubuntu
我继承了一个项目,该项目设置为使用 Entity Framework 在新数据库上设置数据库架构。 该项目最初有两个不同的文件夹——默认的/Migrations 文件夹和另一个文件夹——带有 DbMi
我在我的 Nest 应用程序上运行这行代码: import * as typeOrm from "../node_modules/typeorm/index"; bootstrap(){ //
我需要像下面的代码一样创建一个外键: Create.ForeignKey().FromTable("TCGDocFiscalOpMedItem").ForeignColumn("IDCabecalho
如何从扩展 Migration 的类的 Up(或 Down)方法中获取迁移正在操作的数据库的名称 public class BaseMigration : Migration { public
我们已将迁移添加到我们的xamarin表单项目中,此后我们就无法将其部署到iOS设备上。它可以在模拟器上正常运行,但在部署到设备时会因AOT错误而失败。 这似乎是一个在网络上广泛传播的话题,但是到目前
我正在尝试自己研究 Fluent Migrator,但我遇到了一个问题,我需要更改由 Fluent Migrator 创建的表的结构,这意味着我使用以下代码创建了一个名为 user 的表 [Migr
我正在使用 PostgreSQL、Rails 3.1.3 和 Ruby 1.9.3。我正在努力使用 db:migrate 概述 here . 这是我在终端中看到的: funkdified@funkdi
我决定使用 gorm作为我的 ORM。我想使用 golang-migrate/migrate 进行迁移因为,看起来 GORM 没有版本化迁移文件。我宁愿使用 CLI 进行迁移,而不是使用自动迁移。 我
我正在针对现有 SQL Server 数据库设置 EF Core 3.1.3 迁移。 这是我到目前为止所做的: 从现有数据库搭建我的模型。 添加 InitialCreate 迁移。 删除 Initia
我正在玩 Entity Framework 和持续构建。到目前为止,通过使用 migrate.exe 和适当的参数,我能够毫无问题地运行迁移或一系列迁移。 但是,我在尝试让 migrate.exe 踢
我正在使用包管理器控制台向我的数据库添加迁移,但由于某种原因它只是卡住并且什么也不做。停止它并继续使用它的唯一方法是使用任务管理器关闭 Visual Studio。这是一个已知问题吗? 最佳答案 我不
我在sequelize上运行帮助命令,发现有两个不同的命令具有相同的描述: $ sequelize help:migration:create Sequelize [Node: 6.9.5, CLI:
在这里,我使用的是 Microsoft Azure。 其中,我正在尝试使用开源 DocumentDB 数据迁移工具将数据从各种来源导入 Microsoft Azure DocumentDB,包括 JS
我是 Laravel 的新手。 我正在开发 Laravel 版本 6。 我已经创建了迁移。 第一次运行良好,但如果我更改迁移文件中的某些内容,然后运行 php artisan migrate它显示
我已经使用 NuGet 安装了 Migrator.NET,但是当我尝试使用 MSBuild 运行迁移时,出现以下错误。我看到它在访问 Migrator.Framework 程序集时遇到问题,但我不确定
我有一个基于 miguel flask tutorial 的网络应用程序 所以我将 sqlalchemy-migrate 用于数据库,现在我应该在迁移中使用 Alembic 我该如何配置?有什么方法可
我已经尝试执行 cli 命令 ./doctrine generate-migrations-diff 并在正确的文件夹中正确创建了一个版本文件。 消息是:generate-migrations-dif
可以定义存储迁移的多个路径: doctrine_migrations.yaml doctrine_migrations: migrations_paths: 'App\Migr
我在我的 .Net 应用程序中使用 Fluent Migrator 1.6.2。 对于数据库的上迁移或下迁移,需要通过命令行传递汇编文件(迁移类所在的数据库工程的dll文件)来执行Migrate.ex
我是一名优秀的程序员,十分优秀!