Bladeren bron

fix issue #16.

master
yangxiaodong 7 jaren geleden
bovenliggende
commit
9ef8d4c483
2 gewijzigde bestanden met toevoegingen van 6 en 8 verwijderingen
  1. +3
    -4
      src/DotNetCore.CAP.MySql/CAP.MySqlCapOptionsExtension.cs
  2. +3
    -4
      src/DotNetCore.CAP.SqlServer/CAP.SqlServerCapOptionsExtension.cs

+ 3
- 4
src/DotNetCore.CAP.MySql/CAP.MySqlCapOptionsExtension.cs Bestand weergeven

@@ -26,14 +26,13 @@ namespace DotNetCore.CAP
var sqlServerOptions = new MySqlOptions();
_configure(sqlServerOptions);

var provider = TempBuildService(services);
var dbContextObj = provider.GetService(sqlServerOptions.DbContextType);
if (dbContextObj != null)
if (sqlServerOptions.DbContextType != null)
{
var provider = TempBuildService(services);
var dbContextObj = provider.GetService(sqlServerOptions.DbContextType);
var dbContext = (DbContext)dbContextObj;
sqlServerOptions.ConnectionString = dbContext.Database.GetDbConnection().ConnectionString;
}
services.Configure(_configure);
services.AddSingleton(sqlServerOptions);
}



+ 3
- 4
src/DotNetCore.CAP.SqlServer/CAP.SqlServerCapOptionsExtension.cs Bestand weergeven

@@ -26,14 +26,13 @@ namespace DotNetCore.CAP
var sqlServerOptions = new SqlServerOptions();
_configure(sqlServerOptions);

var provider = TempBuildService(services);
var dbContextObj = provider.GetService(sqlServerOptions.DbContextType);
if (dbContextObj != null)
if (sqlServerOptions.DbContextType != null)
{
var provider = TempBuildService(services);
var dbContextObj = provider.GetService(sqlServerOptions.DbContextType);
var dbContext = (DbContext)dbContextObj;
sqlServerOptions.ConnectionString = dbContext.Database.GetDbConnection().ConnectionString;
}
services.Configure(_configure);
services.AddSingleton(sqlServerOptions);
}



Laden…
Annuleren
Opslaan