浏览代码

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



正在加载...
取消
保存