while issuing following command in linux bash,
dotnet ef dbcontext scaffold "Server=192.168.1.5\MSSQLSERVER2017;Database=TestDb;User Id=test;Password=test@987" Microsoft.EntityFrameworkCore.SqlServer -o Models --context AppDbContext -t solid
I get this error message:
Unrecognized command or argument 'Microsoft.EntityFrameworkCore.SqlServer'
I figured out the problem that it is being caused by space in "User Id" in the command because when i remove space i get this message.
Keyword not supported: 'userid'
I tried lots of combinations like putting User\ Id, 'User Id', "User Id", User" "Id and a lot more I found on the internet but I am still stuck on this. How can I solve this?
My EF version:
Entity Framework Core .NET Command-line Tools 2.1.4-rtm-31024
My dotnet version:
.NET Core SDK (reflecting any global.json): Version: 2.1.500 Commit: b68b931422 Runtime Environment: OS Name: arch OS Version: OS Platform: Linux RID: arch-x64 Base Path: /opt/dotnet/sdk/2.1.500/ Host (useful for support): Version: 2.1.6 Commit: 3f4f8eebd8 .NET Core SDKs installed: 2.1.500 [/opt/dotnet/sdk] .NET Core runtimes installed: Microsoft.NETCore.App 2.1.6 [/opt/dotnet/shared/Microsoft.NETCore.App]
P.S. I've already added "Microsoft.EntityFrameworkCore.Design" package in the project too.
but i fixed it by using the Command below.
> dotnet ef dbcontext scaffold "Server=.\;Database=YourDatabase;Trusted_Connection=False; User ID=sa; Password=YourPassword;" Microsoft.EntityFrameworkCore.SqlServer -o Model -c "YourDBContext"
In my own case, i tried to figure our what was wrong with my previous command and i got some few answers though they might not be applicable to everyone.
Although i took all this steps but the truth is that i don't know which one actually worked but i can assure you that the above code works pretty well. However you can checkout an article i found below. https://www.learnentityframeworkcore.com/walkthroughs/existing-database