public static void AddData(Message message, string name, Func <string> dataProvider)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("name");
            }

            if (dataProvider == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("dataProvider");
            }

            CorrelationDataMessageProperty data = null;
            object value = null;

            if (message.Properties.TryGetValue(PropertyName, out value))
            {
                data = value as CorrelationDataMessageProperty;
            }

            bool addNewProperty = false;

            if (data == null)
            {
                data           = new CorrelationDataMessageProperty();
                addNewProperty = true;
            }

            data.Add(name, dataProvider);

            if (addNewProperty)
            {
                message.Properties[PropertyName] = data;
            }
        }
 public static void AddData(Message message, string name, Func<string> dataProvider)
 {
     if (string.IsNullOrEmpty(name))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("name");
     }
     if (dataProvider == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("dataProvider");
     }
     CorrelationDataMessageProperty property = null;
     object obj2 = null;
     if (message.Properties.TryGetValue("CorrelationDataMessageProperty", out obj2))
     {
         property = obj2 as CorrelationDataMessageProperty;
     }
     bool flag = false;
     if (property == null)
     {
         property = new CorrelationDataMessageProperty();
         flag = true;
     }
     property.Add(name, dataProvider);
     if (flag)
     {
         message.Properties["CorrelationDataMessageProperty"] = property;
     }
 }
示例#3
0
        public static void AddData(Message message, string name, Func <string> dataProvider)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("name");
            }
            if (dataProvider == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("dataProvider");
            }
            CorrelationDataMessageProperty property = null;
            object obj2 = null;

            if (message.Properties.TryGetValue("CorrelationDataMessageProperty", out obj2))
            {
                property = obj2 as CorrelationDataMessageProperty;
            }
            bool flag = false;

            if (property == null)
            {
                property = new CorrelationDataMessageProperty();
                flag     = true;
            }
            property.Add(name, dataProvider);
            if (flag)
            {
                message.Properties["CorrelationDataMessageProperty"] = property;
            }
        }
 public static bool TryGet(Message message, out CorrelationDataMessageProperty property)
 {
     if (message == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message");
     }
     return TryGet(message.Properties, out property);
 }
示例#5
0
 public static bool TryGet(Message message, out CorrelationDataMessageProperty property)
 {
     if (message == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message");
     }
     return(TryGet(message.Properties, out property));
 }
示例#6
0
        public static bool TryGet(MessageProperties properties, out CorrelationDataMessageProperty property)
        {
            object obj2 = null;

            if (properties.TryGetValue("CorrelationDataMessageProperty", out obj2))
            {
                property = obj2 as CorrelationDataMessageProperty;
            }
            else
            {
                property = null;
            }
            return(property != null);
        }
        public static bool TryGet(MessageProperties properties, out CorrelationDataMessageProperty property)
        {
            object value = null;

            if (properties.TryGetValue(PropertyName, out value))
            {
                property = value as CorrelationDataMessageProperty;
            }
            else
            {
                property = null;
            }
            return(property != null);
        }
 protected CorrelationCallbackMessageProperty(CorrelationCallbackMessageProperty callback)
 {
     if (callback == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("callback");
     }
     if (callback.data != null)
     {
         this.data = (CorrelationDataMessageProperty)callback.data.CreateCopy();
     }
     if ((callback.neededData != null) && (callback.neededData.Count > 0))
     {
         this.neededData = new List <string>(callback.neededData);
     }
 }
 protected CorrelationCallbackMessageProperty(CorrelationCallbackMessageProperty callback)
 {
     if (callback == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("callback");
     }
     if (callback.data != null)
     {
         this.data = (CorrelationDataMessageProperty) callback.data.CreateCopy();
     }
     if ((callback.neededData != null) && (callback.neededData.Count > 0))
     {
         this.neededData = new List<string>(callback.neededData);
     }
 }
 public void AddData(string name, Func <string> value)
 {
     if (name == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("name");
     }
     if (value == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value");
     }
     if (this.data == null)
     {
         this.data = new CorrelationDataMessageProperty();
     }
     this.data.Add(name, value);
     if (this.neededData != null)
     {
         this.neededData.Remove(name);
     }
 }
 public void AddData(string name, Func<string> value)
 {
     if (name == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("name");
     }
     if (value == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value");
     }
     if (this.data == null)
     {
         this.data = new CorrelationDataMessageProperty();
     }
     this.data.Add(name, value);
     if (this.neededData != null)
     {
         this.neededData.Remove(name);
     }
 }
 public static bool TryGet(MessageProperties properties, out CorrelationDataMessageProperty property)
 {
     object obj2 = null;
     if (properties.TryGetValue("CorrelationDataMessageProperty", out obj2))
     {
         property = obj2 as CorrelationDataMessageProperty;
     }
     else
     {
         property = null;
     }
     return (property != null);
 }
 public static void AddIncomingContextCorrelationData(Message message)
 {
     CorrelationDataMessageProperty.AddData(message, CorrelationName, () => GetContextCorrelationData(message));
 }
 public static bool TryGet(MessageProperties properties, out CorrelationDataMessageProperty property)
 {
     object value = null;
     if (properties.TryGetValue(PropertyName, out value))
     {
         property = value as CorrelationDataMessageProperty;
     }
     else
     {
         property = null;
     }
     return property != null;
 }
        public static void AddData(Message message, string name, Func<string> dataProvider)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("name");
            }

            if (dataProvider == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("dataProvider");
            }

            CorrelationDataMessageProperty data = null;
            object value = null;
            if (message.Properties.TryGetValue(PropertyName, out value))
            {
                data = value as CorrelationDataMessageProperty;
            }

            bool addNewProperty = false;
            if (data == null)
            {
                data = new CorrelationDataMessageProperty();
                addNewProperty = true;
            }

            data.Add(name, dataProvider);

            if (addNewProperty)
            {
                message.Properties[PropertyName] = data;
            }
        }