As the title says:
dotnet ef dbcontext scaffold "Host=localhost;Database=tribo;Username=tribo;Password=;" Npgsql.EntityFrameworkCore.PostgreSQL -o Models
The above, run on the same folder as a .csproj
file (which must include the Microsoft.EntityFrameworkCore.Design
and Npgsql.EntityFrameworkCore.PostgreSQL
assemblies) will generate a “Models” folder with:
- One class per table.
- A database context file mapping classes to tables and fields, including all relationships.
More info: Generating a model from an existing database | Learn Entity Framework Core.