public void Inititalize(IDictionary <string, string> context)
        {
            var contextActions = ContextActions.Get();

            foreach (var property in context)
            {
                Action <string, TelemetryContext> defaultAction = (value, ctx) => {
                    ctx.Properties.Add(property.Key, value);
                };
                var contextAction = contextActions.ContainsKey(property.Key) ?
                                    contextActions[property.Key] :
                                    defaultAction;

                contextAction(property.Value, client.Context);
            }
        }
Esempio n. 2
0
        public IDictionary <string, string> Translate(IDictionary <string, string> properties)
        {
            var contextActions = ContextActions.Get();
            var result         = new Dictionary <string, string>();

            foreach (var property in properties)
            {
                Action <string, TelemetryContext> defaultAction = (value, context) => {
                    result.Add(property.Key, value);
                };
                var telemetryAction = contextActions.ContainsKey(property.Key) ?
                                      contextActions[property.Key] :
                                      defaultAction;

                telemetryAction(property.Value, client.Context);
            }

            return(result);
        }