实体框架核心从现有数据库创建模型

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

使用Entity Framework Core,如何生成EF模型和实体?

With Entity Framework Core, how do you generate the EF model and the entities?

根据 ASP.NET Core-现有数据库 Microsoft文章,您需要在软件包中运行像这样的命令管理器控制台:

According to ASP.NET Core - Existing Database Microsoft article you need to run a command like this one in the Package Manager Console:

Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models

这使您可以零控制要导入的表或视图。是否有可能是现在使用EF Core对数据库进行反向工程和创建EF模型和实体的唯一方法?与多年来使用完整Entity Framework进行的方法相比,进展如何?

That gives you zero control on what tables or views to import. Is it possible that this is the only way to reverse engineer the database and create the EF models and entities now with EF Core and how is that progress when compared to the way this was done with full Entity Framework for years now?

推荐答案

在Entity Framework Core中无法做到这一点。 在此处阅读文档: https: //docs.microsoft/en-us/ef/efcore-and-ef6/features

There's no way to do that in Entity Framework Core. Read the documentation here: docs.microsoft/en-us/ef/efcore-and-ef6/features

更多推荐

实体框架核心从现有数据库创建模型

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

发布评论

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

>www.elefans.com

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