baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)
This commit is contained in:
commit
c2b0e7be0d
6522 files changed
+3530643
No files matched your search
@@ -0,0 +1,50 @@
|
||||
using Opsoft.NetCore.O3App.Domain;
|
||||
using Opsoft.NetCore.O3App.Domain.Models;
|
||||
|
||||
namespace Opsoft.NetCore.O3App.Infrastructure
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class TraceContextFactory : ITraceContextFactory
|
||||
{
|
||||
private readonly ITraceContextAccessor traceContextAccessor;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:TraceId.TraceContextFactory" /> class.
|
||||
/// </summary>
|
||||
public TraceContextFactory()
|
||||
: this(null)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TraceContextFactory"/> class.
|
||||
/// </summary>
|
||||
/// <param name="traceContextAccessor">The <see cref="ITraceContextAccessor"/> through which the <see cref="TraceContext"/> will be set.</param>
|
||||
public TraceContextFactory(ITraceContextAccessor traceContextAccessor)
|
||||
{
|
||||
this.traceContextAccessor = traceContextAccessor;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public TraceContext Create(string traceId, string header)
|
||||
{
|
||||
var traceContext = new TraceContext(traceId, header);
|
||||
|
||||
if (traceContextAccessor != null)
|
||||
{
|
||||
traceContextAccessor.TraceContext = traceContext;
|
||||
}
|
||||
|
||||
return traceContext;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
if (traceContextAccessor != null)
|
||||
{
|
||||
traceContextAccessor.TraceContext = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user