示例#1
0
 internal static void TraceCommandResultCount(int indentLevel, int count)
 {
     DXInfoTracer.Verbose(indentLevel, "Rows affected: {0}", new object[]
     {
         count
     });
 }
示例#2
0
 public static void Verbose(string format, params object[] args)
 {
     if (DXInfoTracer.IsVerboseEnabled())
     {
         DXInfoTracer.Verbose(string.Format(CultureInfo.InvariantCulture, format, args));
     }
 }
示例#3
0
 public static void Verbose(int indentLevel, string format, params object[] args)
 {
     if (DXInfoTracer.IsVerboseEnabled())
     {
         for (int i = 0; i < indentLevel; i++)
         {
             format = "   " + format;
         }
         DXInfoTracer.Verbose(string.Format(CultureInfo.InvariantCulture, format, args));
     }
 }
示例#4
0
 internal static void TraceCommandAndParameters(int indentLevel, IDbCommand command)
 {
     if (!DXInfoTracer.IsVerboseEnabled())
     {
         return;
     }
     DXInfoTracer.Verbose(indentLevel, "Executing Command: {0}", new object[]
     {
         command.CommandText
     });
     foreach (DbParameter parameter in command.Parameters)
     {
         DXInfoTracer.TraceCommandParameter(indentLevel + 1, parameter);
     }
 }
示例#5
0
        internal static void TraceCommandParameter(int indentLevel, DbParameter parameter)
        {
            if (!DXInfoTracer.IsVerboseEnabled())
            {
                return;
            }
            if (parameter.Direction != ParameterDirection.Input && parameter.Direction != ParameterDirection.InputOutput)
            {
                DXInfoTracer.Verbose(indentLevel, "Parameter: {0} Value: Skipped since Not Input/InputOutput", new object[]
                {
                    parameter.ParameterName
                });
                return;
            }
            string text = "";
            int    num  = parameter.Size;
            string text2;

            if (parameter == null || parameter.Value is DBNull)
            {
                text2 = "NULL";
            }
            else
            {
                if (parameter.Value is byte[])
                {
                    byte[] array = (byte[])parameter.Value;
                    num = array.Length;
                    if (array.Length == 0)
                    {
                        text2 = "<zero length value>";
                    }
                    else
                    {
                        text2 = BitConverter.ToString(array);
                    }
                }
                else
                {
                    text2 = parameter.Value.ToString();
                    Type         type     = parameter.Value.GetType();
                    PropertyInfo property = type.GetProperty("Length");
                    if (property != null && property.PropertyType.ToString().Equals("System.Int32"))
                    {
                        num = (int)property.GetValue(parameter.Value, null);
                    }
                }
            }
            string text3;

            if (text2.Length > 50)
            {
                text3 = text2.Substring(0, 50);
                text  = "...";
            }
            else
            {
                text3 = text2;
            }
            string text4 = (num > 0) ? string.Format(CultureInfo.InvariantCulture, "Len: {0} ", new object[]
            {
                num
            }) : "";

            DXInfoTracer.Verbose(indentLevel, "Parameter: {0} {1}Value: {2}{3}", new object[]
            {
                parameter.ParameterName,
                text4,
                text3,
                text
            });
        }