webapi

发布时间 2023-07-06 01:18:12作者: 彭二狗的牵引绳

services.AddDbContext<MyDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

 

services.AddDbContext<MyDbContext1>(options =>
options.UseSqlServer(Configuration.GetConnectionString("Connection1")));

services.AddDbContext<MyDbContext2>(options =>
options.UseSqlServer(Configuration.GetConnectionString("Connection2")));

 

 

{
"ConnectionStrings": {
"Connection1": "YourConnectionString1",
"Connection2": "YourConnectionString2"
},
...
}