Last post Apr 17, 2018 03:11 AM by Brando ZWZ
Apr 17, 2018 12:17 AM|ChiefWilliams|LINK
I can't seem to find the correct string to connect to an existing database in VS2017 using the Package Manager DBContext-Scaffold command. I want to connect to a local instance of sqlserver, the name of which is GRANTHAM-17o9GJR\SQLEXPRESS and the database
name is Beagle. it uses windows authentication, and if anyone can help me with the string to construct the model I would be most grateful.
Apr 17, 2018 03:11 AM|Brando ZWZ|LINK
Hi George Williams,
According to your description, I suggest you could try below command in the package management console.
Scaffold-DbContext -Connection "Data Source=<yoursqlserver>;Initial Catalog=<databasename>;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False" -Provider "Microsoft.EntityFrameworkCore.SqlServer" -o Models -Context "TestDbContext" -Force
More details about how to create the command, you could refer to below article.