How to scaffold Database in ASP.NET Core using Visual Studio Code
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
Related videos on Youtube
Adrita Sharma
Full-Stack Application Developer enthusiastic and passionate about coding. I am a self motivated person, love to write codes professionally, as well as a hobby. My main area of interests are ASP.NET Framework and Angular. I have extensive experience in designing and building highly scalable and stable web applications by implementing REST APIs and interactive UI. Ranked 1st as Angular Answerer in 2019 Technologies: Backend : ASP.NET( MVC | WebAPI | Core ), C#, Entity Framework, LINQ, NodeJS Frontend: Angular, TypeScript, JavaScript, HTML, CSS, Bootstrap DataBase: MS SQL Server, MySQL, FireBase Others: Kafka, GIT, SVN, JIRA, Confluence, Swagger, HighChart and Google Chart
Updated on May 25, 2022Comments
-
Adrita Sharma almost 2 years
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
-
Mohsen Esmailpour over 6 yearsDid you install
Microsoft.EntityFrameworkCore.Tools
package ? -
Adrita Sharma over 6 yearsYes. Do I need to install something in Visual Studio Code editor?
-