实体框架核心更新

编程入门 行业动态 更新时间:2024-10-24 10:15:48
本文介绍了实体框架核心更新-特定于数据库的迁移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试从nuget的包管理器中找出具体的迁移方法。

I am trying to figure out how to run a specific migration from the package manager in nuget.

我尝试运行:

update-database -TargetMigration test32

但是我确实得到了以下消息:

But I do get this message:

找不到与参数名称'TargetMigration'匹配的参数。

A parameter cannot be found that matches parameter name 'TargetMigration'.

我从Microsoft文档中了解到该命令到以前的ef版本。

I read about that command from Microsoft's documentation to a previous ef version.

因此,我不确定它在ef内核中如何。

So I am not sure how it is in ef core.

推荐答案

根据 EF核心文档,正确的参数名称为 -Target (对于EF Core 1.1)或 -Migration (对于EF Core 2.0)

According to EF Core Docs, correct parameter name is -Target (for EF Core 1.1) or -Migration (for EF Core 2.0)

所以在您的情况下:

update-database -target test32

update-database -migration test32

现代方式是使用常规命令提示符和。NET Core CLI ,并使用 dotnet ef数据库更新< target>

"Modern" way is to use "regular" command prompt and .NET Core CLI, and command like dotnet ef database update <target>

更多推荐

实体框架核心更新

本文发布于:2023-11-10 22:40:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1576662.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:实体   框架   核心

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!