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.
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
So I assume you are trying to create all the classes based on your existing database.
This is done with the
Scaffold-DbContext command. You can use it manually as described here, but I prefer to use the EFCorePowerTools plugin. Use the Reverse Engineer feature, which will generate and run the appropriate
Scaffold-DbContext command for you.