Reputation: 27955
Looking for a method to automatically create entity classes from existing Postgres 13 database. in
According to
http://www.npgsql.org/efcore/index.html
In Visual Studio 2019 command prompt
dotnet ef dbcontext scaffold "Host=my_host;Database=my_db;Username=my_user;Password=my_pw" Npgsql.EntityFrameworkCore.PostgreSQL
Command should do this but it throws error
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET program, but dotnet-ef does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
NpgSql.EntityFrameworkCore.PostgreSQL v5.0.1 package is installed from Nuget.
Upvotes: 1
Views: 4298
Reputation: 1270
You should install Dotnet EF tool.
try this in your package manager console
dotnet tool install --global dotnet-ef
After that it is recommended to install design tool aswell so you can use tools on specific project
dotnet add package Microsoft.EntityFrameworkCore.Design
Upvotes: 4