瀏覽代碼

fixed consumer method injection context bug. (#34)

master
yangxiaodong 7 年之前
父節點
當前提交
8c5da12d83
共有 1 個文件被更改,包括 8 次插入4 次删除
  1. +8
    -4
      src/DotNetCore.CAP/Internal/ConsumerInvokerFactory.cs

+ 8
- 4
src/DotNetCore.CAP/Internal/ConsumerInvokerFactory.cs 查看文件

@@ -1,5 +1,6 @@
using System;
using DotNetCore.CAP.Abstractions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

namespace DotNetCore.CAP.Internal
@@ -22,12 +23,15 @@ namespace DotNetCore.CAP.Internal

public IConsumerInvoker CreateInvoker(ConsumerContext consumerContext)
{
var context = new ConsumerInvokerContext(consumerContext)
using(var scope = _serviceProvider.CreateScope())
{
Result = new DefaultConsumerInvoker(_logger, _serviceProvider, _modelBinderFactory, consumerContext)
};
var context = new ConsumerInvokerContext(consumerContext)
{
Result = new DefaultConsumerInvoker(_logger, scope.ServiceProvider, _modelBinderFactory, consumerContext)
};

return context.Result;
return context.Result;
}
}
}
}

Loading…
取消
儲存