25 lines
868 B
C#
Executable File
25 lines
868 B
C#
Executable File
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
|
using Opsoft.NetCore.O3App.Domain;
|
|
|
|
namespace Opsoft.NetCore.O3App.Infrastructure
|
|
{
|
|
/// <summary>
|
|
/// Extensions on the <see cref="IServiceCollection"/>.
|
|
/// </summary>
|
|
public static class TraceIdServiceExtensions
|
|
{
|
|
/// <summary>
|
|
/// Adds required services to support the Trace ID functionality.
|
|
/// </summary>
|
|
/// <param name="serviceCollection"></param>
|
|
public static IServiceCollection AddTraceId(this IServiceCollection serviceCollection)
|
|
{
|
|
serviceCollection.TryAddSingleton<ITraceContextAccessor, TraceContextAccessor>();
|
|
serviceCollection.TryAddTransient<ITraceContextFactory, TraceContextFactory>();
|
|
|
|
return serviceCollection;
|
|
}
|
|
}
|
|
}
|