Search code examples
c#.netentity-frameworkreverse-engineeringscaffolding

Entity Framework Core creating model from existing database


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

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

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?


Solution

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