Currently I am reading some documentations on creating web API using the Database first approach. I noticed that most of the tutorials migrate their table on their application. How do I make an web API that only expose or has one route to expose the table in a specific database using Entity Framework that no need data migration?
You just need to download 4 from nugets and run Scaffold-DbContext command. Download these 4 from nugets.
1) EntityFrameworkCore
2) EntityFrameworkCore.Design
3) EntityFrameworkCore.Tools
4) EntityFrameworkCore.SqlServer
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