Answers for "scaffold-dbcontext login failed for user"

0

scaffold-dbcontext login failed for user

When I use the PMC in Visual Studio and try to Scaffold-DbContext with 
Scaffold-DbContext “Data Source=localhost;Database=Library;Integrated Security=True” Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
I get error login failed.
The correct way to go about it is to get the connection string for the database from View->Sql Server Object Explorer and go to the Properties of the Database. Use the connection string from there
So in this specific case the correct PMC command was:
Scaffold-DbContext “Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=Library;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False” Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
Posted by: Guest on September-03-2021

Code answers related to "scaffold-dbcontext login failed for user"

Browse Popular Code Answers by Language