Skip to content

Commit

Permalink
Move Sample app connection string to configuration file (#621)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpreyskurantov authored Jun 18, 2024
1 parent c94a149 commit 17125a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion net/Sample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static void Main(string[] args) {
.AddEntityFrameworkSqlServer()
.AddDbContext<NorthwindContext>(options => options
//.UseSqlServer("Server=.\\SQLEXPRESS; Database=Northwind; Trusted_Connection=True")
.UseSqlServer("Data Source=(localdb)\\MSSQLLocalDB; Database=Northwind; Integrated Security=True; MultipleActiveResultSets=True; App=EntityFramework")
.UseSqlServer(builder.Configuration.GetConnectionString("NorthwindConnectionString"))
);

var app = builder.Build();
Expand Down
6 changes: 6 additions & 0 deletions net/Sample/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"ConnectionStrings": {
"NorthwindConnectionString": "Data Source=(localdb)\\MSSQLLocalDB; Database=Northwind; Integrated Security=True; MultipleActiveResultSets=True; App=EntityFramework",
"NorthwindConnectionStringIis": "Data Source=.; Database=Northwind; User Id=; Password=; MultipleActiveResultSets=True; App=EntityFramework; TrustServerCertificate=True"
}
}

0 comments on commit 17125a2

Please sign in to comment.