I have a site that was built using database first and I'm trying to continue development of it on a mac. Normally I would run the Scaffold-dbContext using the Console Package Manager in Visual Studio. The mac version doesn't have this I tried running it in Terminal, but that obviously didn't work. Is it possible to run this command, or do I need to continue development on Windows?
Here is the code work for me on visual studio mac
Install the below package using visual studio mac edit references on project or add package to .csproj file.
Microsoft.EntityFrameworkCore.SqlServer
Microsoft.EntityFrameworkCore.Tools
Microsoft.VisualStudio.Web.CodeGeneration.Design
or using the Terminal navigate to the project and use the below command -
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
dotnet add package Microsoft.EntityFrameworkCore.Tools
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
Now check the tools and EF are installed or not.Navigate to the project install location and use mac terminal with below command. It should show entity framework details
dotnet ef
Now Scaffold the DB context
dotnet ef dbcontext Scaffold "Server=<servername>,1433;Initial Catalog=<dbName>;Persist Security Info=False;User ID=<userID>;Password=<password>;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"Microsoft.EntityFrameworkCore.SqlServer -o <directory name>
References
https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/dotnet
https://docs.microsoft.com/en-us/ef/core/get-started/aspnetcore/existing-db
https://www.learnentityframeworkcore.com/walkthroughs/existing-database