使用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
更多推荐
实体框架核心从现有数据库创建模型
发布评论