Read connection string explicitly.
This commit is contained in:
parent
a76b6cac24
commit
1428d31463
|
|
@ -41,7 +41,8 @@ namespace MusicStore
|
|||
{
|
||||
services.AddEntityFramework()
|
||||
.AddSqlServer()
|
||||
.AddDbContext<MusicStoreContext>();
|
||||
.AddDbContext<MusicStoreContext>(options =>
|
||||
options.UserSqlServer(Configuration.Get("Data:DefaultConnection:ConnectionString")));
|
||||
}
|
||||
|
||||
// Add Identity services to the services container
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ namespace MusicStore
|
|||
// Add EF services to the services container
|
||||
services.AddEntityFramework()
|
||||
.AddSqlServer()
|
||||
.AddDbContext<MusicStoreContext>();
|
||||
.AddDbContext<MusicStoreContext>(options =>
|
||||
options.UserSqlServer(Configuration.Get("Data:DefaultConnection:ConnectionString")));
|
||||
|
||||
// Add MVC services to the services container
|
||||
services.AddMvc();
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ namespace MusicStore
|
|||
{
|
||||
services.AddEntityFramework()
|
||||
.AddSqlServer()
|
||||
.AddDbContext<MusicStoreContext>();
|
||||
.AddDbContext<MusicStoreContext>(options =>
|
||||
options.UserSqlServer(Configuration.Get("Data:DefaultConnection:ConnectionString")));
|
||||
}
|
||||
|
||||
// Add Identity services to the services container
|
||||
|
|
|
|||
|
|
@ -7,10 +7,5 @@
|
|||
// "Server=(localdb)\\.\\IIS_DB;Database=MusicStore;Trusted_Connection=False;MultipleActiveResultSets=true;User ID=iis_login;Password=********"
|
||||
"Connectionstring": "Server=(localdb)\\MSSQLLocalDB;Database=MusicStore;Trusted_Connection=True;MultipleActiveResultSets=true"
|
||||
}
|
||||
},
|
||||
"EntityFramework": {
|
||||
"MusicStoreContext": {
|
||||
"ConnectionString": "Name=Data:DefaultConnection:ConnectionString"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue