Ejemplo n.º 1
0
        public void TraceIdAccessorTest()
        {
            var accessor1 = new TraceIdAccessor(null);
            var accessor2 = new TraceIdAccessor(null);

            var id1 = accessor1.GetTraceId();
            var id2 = accessor2.GetTraceId();

            id1.ShouldNotBe(id2);
        }
        /// <summary>
        /// Create a new instance of <see cref="RuntimeScopedRepositoryMetadata"/>
        /// </summary>
        /// <param name="metadata"></param>
        /// <param name="instance"></param>
        /// <param name="accessor"></param>
        internal RuntimeScopedRepositoryMetadata(IRepositoryMetadata metadata, IRepository instance, TraceIdAccessor accessor = null)
        {
            metadata.CheckNull(nameof(metadata));
            Instance = instance ?? throw new ArgumentNullException(nameof(instance));
            TranceId = accessor?.GetTraceId();

            Name          = metadata.Name;
            ServiceType   = metadata.ServiceType;
            ImplementType = metadata.ImplementType;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Create a new instance of <see cref="SystemTraceIdGenerator"/>.
 /// </summary>
 /// <param name="traceIdAccessor"></param>
 /// <param name="fallbackTraceIdAccessor"></param>
 public SystemTraceIdGenerator(TraceIdAccessor traceIdAccessor, FallbackTraceIdAccessor fallbackTraceIdAccessor)
 {
     _accessor = traceIdAccessor;
     _fallback = fallbackTraceIdAccessor;
 }
 /// <summary>
 /// Convert to runtime scoped repository metadata
 /// </summary>
 /// <param name="metadata"></param>
 /// <param name="instance"></param>
 /// <param name="accessor"></param>
 /// <returns></returns>
 public static RuntimeScopedRepositoryMetadata RuntimeScoped(this IRepositoryMetadata metadata, IRepository instance, TraceIdAccessor accessor = null)
 {
     metadata.CheckNull(nameof(metadata));
     return(new RuntimeScopedRepositoryMetadata(metadata, instance, accessor));
 }