我不知道如何使用EntityFramework.Commands(也为v7.0.0-rc1-final)在EntityFramework.Core(v7.0.0-rc1-final)中运行迁移。 当我添加迁移(Add-Migration)时,会创建迁移。然后,当我输入Update-Database时,PM控制台将返回:
I don't know how I have run the migration in EntityFramework.Core(v7.0.0-rc1-final) using EntityFramework.Commands(also v7.0.0-rc1-final). When I add the migration (Add-Migration) so migration creates. Then, when I enter the Update-Database, so the PM console returns:
Universal Windows应用程序不应使用Update-Database。而是,调用DbContext。数据库。在运行时迁移()。
Update-Database should not be used with Universal Windows apps. Instead, call DbContext. Database. Migrate () at runtime.
但是Context.Database不包含方法Migrate()。因此无法指定此命令。在我看来,这是一个错误。
But the Context.Database does not contain method Migrate(). So this command cannot be specified. It seems to me that this is a bug.
推荐答案在RC1中,确保使用Microsoft的 .Data.Entity; 在文档中。 Migrate()是一种扩展方法,当您安装关系提供程序时,例如EntityFramework.Sqlite。
In RC1, make sure you have using Microsoft.Data.Entity; in the document. Migrate() is an extension method that is available when you install a relational provider, such as EntityFramework.Sqlite.
using (var db = new BloggingContext()) { db.Database.Migrate(); }请参见 docs.efproject/en/latest/platforms/uwp/getting-started.html
更多推荐
如何使用ef core 1在UWP中运行迁移
发布评论