Commit 1f09d935 authored by Savorboard's avatar Savorboard

Fix transaction scope disposed bug. #365

parent 8b821000
...@@ -34,21 +34,7 @@ namespace DotNetCore.CAP.Abstractions ...@@ -34,21 +34,7 @@ namespace DotNetCore.CAP.Abstractions
protected IServiceProvider ServiceProvider { get; } protected IServiceProvider ServiceProvider { get; }
public ICapTransaction Transaction public ICapTransaction Transaction => _transaction ?? (_transaction = ServiceProvider.GetRequiredService<CapTransactionBase>());
{
get
{
if (_transaction == null)
{
using (var scope = ServiceProvider.CreateScope())
{
_transaction = scope.ServiceProvider.GetRequiredService<CapTransactionBase>();
}
}
return _transaction;
}
}
public void Publish<T>(string name, T contentObj, string callbackName = null) public void Publish<T>(string name, T contentObj, string callbackName = null)
{ {
......
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