Browse Source

Fix transaction scope disposed bug. #365

master
Savorboard 5 years ago
parent
commit
1f09d9354d
1 changed files with 1 additions and 15 deletions
  1. +1
    -15
      src/DotNetCore.CAP/Abstractions/CapPublisherBase.cs

+ 1
- 15
src/DotNetCore.CAP/Abstractions/CapPublisherBase.cs View File

@@ -34,21 +34,7 @@ namespace DotNetCore.CAP.Abstractions

protected IServiceProvider ServiceProvider { get; }

public ICapTransaction Transaction
{
get
{
if (_transaction == null)
{
using (var scope = ServiceProvider.CreateScope())
{
_transaction = scope.ServiceProvider.GetRequiredService<CapTransactionBase>();
}
}

return _transaction;
}
}
public ICapTransaction Transaction => _transaction ?? (_transaction = ServiceProvider.GetRequiredService<CapTransactionBase>());

public void Publish<T>(string name, T contentObj, string callbackName = null)
{


Loading…
Cancel
Save