[英]How do I make migrations in Entity Framework?
My research keeps telling me to use the Migrate.exe
, which has not shown up in my project, and it cannot be downloaded anywhere.我的研究一直告诉我使用Migrate.exe
,它没有出现在我的项目中,并且无法在任何地方下载。 I am also using VS Code and not Visual Studio, which seems to make it impossible to use the Package Manager Console.我也在使用 VS Code 而不是 Visual Studio,这似乎使得无法使用 Package 管理器控制台。
And I am using Entity Framework - not Entity Framework Core - so I do not have all the options of EFC.而且我使用的是实体框架——而不是实体框架核心——所以我没有 EFC 的所有选项。
Currently I am trying to set Entity Framework up in Unity, the game engine.目前我正在尝试在游戏引擎 Unity 中设置实体框架。 It was possible to set up a temporary project with Entity Framework v6.2.0 and run dotnet pack
to get the EntityFramework.dll
but it does not create the Migrate.exe
.可以使用 Entity Framework v6.2.0 设置一个临时项目并运行dotnet pack
以获取EntityFramework.dll
但它不会创建Migrate.exe
。 And it seems to be the only option for creating migrations.它似乎是创建迁移的唯一选择。
Do any of you know how to get the Migrate.exe
file or another way to add migrations?你们中有人知道如何获取Migrate.exe
文件或其他方式来添加迁移吗?
Apparently there is a difference in installing and adding, not that they mention that when you look at the package on nuget.org.显然安装和添加是有区别的,并不是说当您查看 nuget.org 上的 package 时,他们会提到这一点。
So rather than running dotnet add package EntityFramework --version 6.2.0
I needed to download the latest nuget.exe from nuget.org and create a packages.config file in the root folder.因此,我需要从 Z0558440846982BFE7FF23B159C377F9B 文件夹中下载最新的 nuget.exe,而不是运行dotnet add package EntityFramework --version 6.2.0
并创建 packages.org 文件。
I then ran nuget.exe install packages.config -OutputDirectory packages
which installed all the files I needed.然后我运行nuget.exe install packages.config -OutputDirectory packages
安装了我需要的所有文件。
packages.config:包.config:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.2.0" targetFramework="net40" />
</packages>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.