I have to create a layered .net core application including a database. I want to build the database entities with sql-first approach. The solution looks like this:
All of the projects are class libaries, except the FoodSupplementCompany.Program
.
My question is, how can I use Scaffold-DbContext
to generate the entities to the FoodSupplementCompany.Data
project?
As the guide here states: scaffold-dbcontext
Example:
Scaffold-DbContext
"Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;"
Microsoft.EntityFrameworkCore.SqlServer
-OutputDir Models
-OutputDir
-> The directory to put files in. Paths are relative to the project directory.