Commit 0ad6a92e authored by Savorboard's avatar Savorboard

fixed callback topic send error bug.

parent c21f9705
...@@ -30,11 +30,11 @@ namespace DotNetCore.CAP.MySql ...@@ -30,11 +30,11 @@ namespace DotNetCore.CAP.MySql
_dbContext = (DbContext) ServiceProvider.GetService(_options.DbContextType); _dbContext = (DbContext) ServiceProvider.GetService(_options.DbContextType);
} }
public Task PublishAsync(CapPublishedMessage message) public async Task PublishAsync(CapPublishedMessage message)
{ {
using (var conn = new MySqlConnection(_options.ConnectionString)) using (var conn = new MySqlConnection(_options.ConnectionString))
{ {
return conn.ExecuteAsync(PrepareSql(), message); await conn.ExecuteAsync(PrepareSql(), message);
} }
} }
......
...@@ -31,12 +31,12 @@ namespace DotNetCore.CAP.PostgreSql ...@@ -31,12 +31,12 @@ namespace DotNetCore.CAP.PostgreSql
_dbContext = (DbContext) ServiceProvider.GetService(_options.DbContextType); _dbContext = (DbContext) ServiceProvider.GetService(_options.DbContextType);
} }
} }
public Task PublishAsync(CapPublishedMessage message) public async Task PublishAsync(CapPublishedMessage message)
{ {
using (var conn = new NpgsqlConnection(_options.ConnectionString)) using (var conn = new NpgsqlConnection(_options.ConnectionString))
{ {
return conn.ExecuteAsync(PrepareSql(), message); await conn.ExecuteAsync(PrepareSql(), message);
} }
} }
......
...@@ -28,14 +28,14 @@ namespace DotNetCore.CAP.SqlServer ...@@ -28,14 +28,14 @@ namespace DotNetCore.CAP.SqlServer
if (_options.DbContextType == null) return; if (_options.DbContextType == null) return;
IsUsingEF = true; IsUsingEF = true;
_dbContext = (DbContext) ServiceProvider.GetService(_options.DbContextType); _dbContext = (DbContext)ServiceProvider.GetService(_options.DbContextType);
} }
public Task PublishAsync(CapPublishedMessage message) public async Task PublishAsync(CapPublishedMessage message)
{ {
using (var conn = new SqlConnection(_options.ConnectionString)) using (var conn = new SqlConnection(_options.ConnectionString))
{ {
return conn.ExecuteAsync(PrepareSql(), message); await conn.ExecuteAsync(PrepareSql(), message);
} }
} }
...@@ -66,7 +66,7 @@ namespace DotNetCore.CAP.SqlServer ...@@ -66,7 +66,7 @@ namespace DotNetCore.CAP.SqlServer
protected override Task ExecuteAsync(IDbConnection dbConnection, IDbTransaction dbTransaction, protected override Task ExecuteAsync(IDbConnection dbConnection, IDbTransaction dbTransaction,
CapPublishedMessage message) CapPublishedMessage message)
{ {
dbConnection.ExecuteAsync(PrepareSql(), message, dbTransaction); dbConnection.ExecuteAsync(PrepareSql(), message, dbTransaction);
_logger.LogInformation("Published Message has been persisted in the database. name:" + message); _logger.LogInformation("Published Message has been persisted in the database. name:" + message);
......
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