/// <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); }
/// <summary> /// Default constructor for Empty /// </summary> public WorkContext() { Cv = new CorrelationVector(); Tag = Tag.Empty; Properties = PropertyBag.Empty; EventLog = new TelemetryLogNull(); Dimensions = EventDimensions.Empty; }
/// <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>(); }
/// <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; }
/// <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(); }
/// <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>(); }
/// <summary> /// Default constructor for Empty /// </summary> private WorkContext() { Cv = new CorrelationVector(); Tag = Tag.Empty; Properties = new Dictionary <string, object>().AsTypeOrDefault <IProperties>(); }
/// <summary> /// Default construct /// </summary> public WorkContextBuilder() { Properties = new Dictionary <string, object>(); Cv = new CorrelationVector(); Tag = Tag.Empty; }