ソースを参照

fix issue #16.

master
yangxiaodong 7年前
コミット
9ef8d4c483
2個のファイルの変更6行の追加8行の削除
  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 ファイルの表示

@@ -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 ファイルの表示

@@ -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);
}



読み込み中…
キャンセル
保存