We are porting an
ASP.NET MVC 4.x application to
ASP.NET Core 3.1. The current application is using
EF 6.x DB first approach. As a part of this migration we are going to use
EF Core 3.1 as an alternative to the current
EF 6.x. So the question is:
Does EF Core 3.1 support DB First approach?
If not, what are the options? Are we left with only code first approach?
Appreciate your helps.
Yes. It supports DB First Approach since .NET Core 1.0 until now. You need to download 4 from nugets
Open Tools > NuGet Package Manager > Package Manager Console. And enter this below in console.
Scaffold-DbContext "Server=yourserveraddress;Database=yourdatabase;user id=youruser;password=yourpassword;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -Context "YourOwnContext"
Saw your comment about "Scaffold-DbContext only creates a Code First model". No, Scaffold-DbContext is Database-First approach.
"Creating entity & context classes for an existing database is called Database-First approach."