Commit 9f6b0e5d authored by Savorboard's avatar Savorboard

resolve version conflicts

parents 8d564cde 8744532f
...@@ -32,9 +32,13 @@ namespace DotNetCore.CAP ...@@ -32,9 +32,13 @@ namespace DotNetCore.CAP
{ {
services.AddSingleton(x => services.AddSingleton(x =>
{ {
var dbContext = (DbContext)x.GetService(mysqlOptions.DbContextType); using (var scope = x.CreateScope())
mysqlOptions.ConnectionString = dbContext.Database.GetDbConnection().ConnectionString; {
return mysqlOptions; var provider = scope.ServiceProvider;
var dbContext = (DbContext)provider.GetService(mysqlOptions.DbContextType);
mysqlOptions.ConnectionString = dbContext.Database.GetDbConnection().ConnectionString;
return mysqlOptions;
}
}); });
} }
else else
......
...@@ -32,9 +32,13 @@ namespace DotNetCore.CAP ...@@ -32,9 +32,13 @@ namespace DotNetCore.CAP
{ {
services.AddSingleton(x => services.AddSingleton(x =>
{ {
var dbContext = (DbContext)x.GetService(postgreSqlOptions.DbContextType); using (var scope = x.CreateScope())
postgreSqlOptions.ConnectionString = dbContext.Database.GetDbConnection().ConnectionString; {
return postgreSqlOptions; var provider = scope.ServiceProvider;
var dbContext = (DbContext)provider.GetService(postgreSqlOptions.DbContextType);
postgreSqlOptions.ConnectionString = dbContext.Database.GetDbConnection().ConnectionString;
return postgreSqlOptions;
}
}); });
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment