使用实体数据模型EF Core 6

发布于 2025-02-10 20:22:26 字数 895 浏览 3 评论 0 原文

我尝试将一个应用程序从.NET 4.7迁移到.NET Core 6。

我使用Net Core 6 SDK安装了Visual Studio 2022,然后创建一个类库,然后从Nugget安装EF Core。

现在,想使用“ ADO.NET实体数据模型”类似于.NET Framework 4.7的“创建模型”中的“ ADO.NET实体数据模型”创建我的类模型。

我的班级库依赖性:

“在此处输入图像描述”

datamodel创建:

“在此处输入图像说明”

但它给我带来了以下错误。

​我还缺少什么其他依赖性?

i'm try migrate an application from .net 4.7 to .net core 6.

i installed visual studio 2022 with net core 6 sdk, then create a class library and install EF Core from nugget.

Now, want to create my class model using "ADO.NET Entity Data Model " like in .net framework 4.7 for create model from existing BD.

my class library dependences:

enter image description here

DataModel creation:

enter image description here

But it throws me the following error.

enter image description here

enter image description here

I don't understand the problem since I have .NET Core 6 installed with its sdk. What other dependency would I be missing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一曲琵琶半遮面シ 2025-02-17 20:22:26

如果要从DB生成模型和上下文,则需要使用EF Core 脚手架使用可用工具, cli pmc

逆向工程是基于数据库架构的脚手架实体类型类和DBContext类的过程。可以使用EF Core Package Manager Console(PMC)工具的脚手架dbContext命令或.NET命令行界面(CLI)工具的dotnet EF dbcontext支架命令。

>

If you want to generate your model and context from the db you need to use ef core scaffolding using the tools available, cli or PMC

Reverse engineering is the process of scaffolding entity type classes and a DbContext class based on a database schema. It can be performed using the Scaffold-DbContext command of the EF Core Package Manager Console (PMC) tools or the dotnet ef dbcontext scaffold command of the .NET Command-line Interface (CLI) tools.

慈悲佛祖 2025-02-17 20:22:26

.NET 6.0不支持它
您可以将目标框架更改为.NET框架4.8
另一个选择是使用存储库模式并使用EF数据模式跳过。

我希望这会有所帮助。

It is not supported with .NET 6.0
You can change the target framework to .NET framework 4.8
Another option is to use Repository pattern and skip using EF data modal.

I hope this would help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文