24 lines
693 B
C#
Executable File
24 lines
693 B
C#
Executable File
using Opsoft.NetCore.O3App.Domain;
|
|
using Opsoft.NetCore.O3App.Domain.Models;
|
|
using System.Threading;
|
|
|
|
namespace Opsoft.NetCore.O3App.Infrastructure
|
|
{
|
|
/// <inheritdoc />
|
|
public class TraceContextAccessor : ITraceContextAccessor
|
|
{
|
|
private static AsyncLocal<TraceContext> traceContext = new AsyncLocal<TraceContext>();
|
|
private volatile int transactionSequence;
|
|
|
|
/// <inheritdoc />
|
|
public TraceContext TraceContext
|
|
{
|
|
get => traceContext.Value;
|
|
set => traceContext.Value = value;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public long TransactionSequence => Interlocked.Increment(ref transactionSequence);
|
|
}
|
|
}
|