示例#1
0
        /// <summary>
        /// Set correlation vector
        /// </summary>
        /// <param name="cv">cv</param>
        /// <returns>this</returns>
        public WorkContextBuilder Set(CorrelationVector cv)
        {
            Verify.IsNotNull(nameof(cv), cv);

            Cv = cv;
            return(this);
        }
示例#2
0
 /// <summary>
 /// Default constructor for Empty
 /// </summary>
 public WorkContext()
 {
     Cv         = new CorrelationVector();
     Tag        = Tag.Empty;
     Properties = PropertyBag.Empty;
     EventLog   = new TelemetryLogNull();
     Dimensions = EventDimensions.Empty;
 }
示例#3
0
 /// <summary>
 /// Default construct
 /// </summary>
 public WorkContextBuilder()
 {
     Properties = new Dictionary <string, object>();
     Cv         = new CorrelationVector();
     Tag        = Tag.Empty;
     EventLog   = new TelemetryLogNull();
     Dimensions = new Dictionary <string, object>();
 }
示例#4
0
        /// <summary>
        /// Construct work context, for values that are not known to be immutable, shallow copies are made
        /// </summary>
        /// <param name="cv">correlation vector</param>
        /// <param name="tag">code location tag</param>
        /// <param name="workContainer">container</param>
        /// <param name="properties">properties (optional)</param>
        public WorkContext(CorrelationVector cv, Tag tag, ILifetimeScope workContainer, IEnumerable <KeyValuePair <string, object> > properties = null, CancellationToken?cancellationToken = null)
        {
            Verify.IsNotNull(nameof(cv), cv);
            Verify.IsNotNull(nameof(tag), tag);

            Cv                = cv;
            Tag               = tag;
            Container         = workContainer;
            Properties        = properties.ToDictionary(x => x.Key, x => x.Value) ?? new Dictionary <string, object>();
            CancellationToken = cancellationToken ?? CancellationToken.None;
        }
示例#5
0
        /// <summary>
        /// Construct work context, for values that are not known to be immutable, shallow copies are made
        /// </summary>
        /// <param name="cv">correlation vector</param>
        /// <param name="tag">code location tag</param>
        /// <param name="workContainer">container</param>
        /// <param name="properties">properties (optional)</param>
        /// <param name="cancellationToken">Cancellation token</param>
        /// <param name="eventLog"></param>
        /// <param name="dimensions"></param>
        public WorkContext(
            CorrelationVector cv,
            Tag tag,
            ILifetimeScope workContainer,
            IPropertyBag properties             = null,
            CancellationToken?cancellationToken = null,
            ITelemetry eventLog         = null,
            IEventDimensions dimensions = null
            )
        {
            Verify.IsNotNull(nameof(cv), cv);
            Verify.IsNotNull(nameof(tag), tag);

            Cv                = cv;
            Tag               = tag;
            Container         = workContainer;
            Properties        = properties != null ? new PropertyBag(properties) : new PropertyBag();
            CancellationToken = cancellationToken ?? CancellationToken.None;
            EventLog          = eventLog ?? new TelemetryLogNull();
            Dimensions        = dimensions != null ? new EventDimensions(dimensions) : new EventDimensions();
        }
示例#6
0
        /// <summary>
        /// Construct work context, for values that are not known to be immutable, shallow copies are made
        /// </summary>
        /// <param name="cv">correlation vector</param>
        /// <param name="tag">code location tag</param>
        /// <param name="workContainer">container</param>
        /// <param name="properties">properties (optional)</param>
        /// <param name="cancellationToken">Cancellation token</param>
        public WorkContext(
            CorrelationVector cv,
            Tag tag,
            ILifetimeScope workContainer,
            IProperties properties = null,
            CancellationToken?cancellationToken = null,
            IEventLog eventLog          = null,
            IEventDimensions dimensions = null
            )
        {
            Verify.IsNotNull(nameof(cv), cv);
            Verify.IsNotNull(nameof(tag), tag);

            Cv                = cv;
            Tag               = tag;
            Container         = workContainer;
            Properties        = (properties?.ToDictionary(x => x.Key, x => x.Value) ?? new Dictionary <string, object>()).AsTypeOrDefault <IProperties>();
            CancellationToken = cancellationToken ?? CancellationToken.None;
            EventLog          = eventLog ?? new EventLogNull();
            Dimensions        = dimensions ?? new Dictionary <string, string>().AsTypeOrDefault <IEventDimensions>();
        }
示例#7
0
 /// <summary>
 /// Default constructor for Empty
 /// </summary>
 private WorkContext()
 {
     Cv         = new CorrelationVector();
     Tag        = Tag.Empty;
     Properties = new Dictionary <string, object>().AsTypeOrDefault <IProperties>();
 }
示例#8
0
 /// <summary>
 /// Default construct
 /// </summary>
 public WorkContextBuilder()
 {
     Properties = new Dictionary <string, object>();
     Cv         = new CorrelationVector();
     Tag        = Tag.Empty;
 }