I have tried using the following command ( which works fine if I use Visual Studio) :
Scaffold-DbContext "Server=12.345.567.890;Database=ABC;Trusted_Connection=True;User Id=xyz;Password=12345;Integrated Security=false;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -f
While trying the above command using Visual Studio code terminal, I get this error:
The term 'Scaffold-DbContext' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again
You may have to run the command line version of scaffolding. The command you have posted is for the Package Manager in Visual Studio
dotnet ef dbcontext scaffold "Server=12.345.567.890;Database=ABC;Trusted_Connection=True;User Id=xyz;Password=12345;Integrated Security=false;" Microsoft.EntityFrameworkCore.SqlServer -o Models
Source ASP.NET Core - Write Apps with Visual Studio Code and Entity Framework
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With