Пример #1
0
 private string SanitizePropertyValueForLogging(object propertyValue)
 {
     if (propertyValue == null)
     {
         return(string.Empty);
     }
     return(ContactLinkingStrings.GetValueString(propertyValue));
 }
Пример #2
0
        public void Add(T fieldId, object value)
        {
            string valueString = ContactLinkingStrings.GetValueString(value);

            if (valueString != null)
            {
                string fieldIdString = SchemaBasedLogEvent <T> .GetFieldIdString(fieldId);

                this.data[fieldIdString]    = valueString;
                this.recalculateStringValue = true;
            }
        }
        public static string GetValueString(object value)
        {
            if (value == null)
            {
                return(null);
            }
            string text = value as string;

            if (text != null)
            {
                return(ContactLinkingStrings.GetValueString(text));
            }
            byte[] array = value as byte[];
            if (array != null)
            {
                return(ContactLinkingStrings.GetValueString(array));
            }
            Guid?nullableGuid = value as Guid?;

            if (nullableGuid != null)
            {
                return(ContactLinkingStrings.GetValueString(nullableGuid));
            }
            VersionedId versionedId = value as VersionedId;

            if (versionedId != null)
            {
                return(ContactLinkingStrings.GetValueString(versionedId));
            }
            IEnumerable enumerable = value as IEnumerable;

            if (enumerable != null)
            {
                return(ContactLinkingStrings.GetValueString(enumerable));
            }
            ExDateTime?nullableExDateTime = value as ExDateTime?;

            if (nullableExDateTime != null)
            {
                return(ContactLinkingStrings.GetValueString(nullableExDateTime));
            }
            DateTime?nullableDateTime = value as DateTime?;

            if (nullableDateTime != null)
            {
                return(ContactLinkingStrings.GetValueString(nullableDateTime));
            }
            return(value.ToString());
        }
        private static void AddToString(StringBuilder text, string description, object value)
        {
            string valueString = ContactLinkingStrings.GetValueString(value);

            if (valueString != null)
            {
                if (text.Length > 0)
                {
                    text.Append(", ");
                }
                text.Append(description);
                text.Append("=");
                text.Append(valueString);
            }
        }
        public static string GetValueString(IEnumerable collection)
        {
            StringBuilder stringBuilder = new StringBuilder(100);

            stringBuilder.Append("{");
            foreach (object value in collection)
            {
                stringBuilder.Append(ContactLinkingStrings.GetValueString(value));
                stringBuilder.Append(",");
            }
            if (stringBuilder.Length > 1)
            {
                stringBuilder[stringBuilder.Length - 1] = '}';
                return(stringBuilder.ToString());
            }
            return(string.Empty);
        }