예제 #1
0
 public static void Info(int indentLevel, string message)
 {
     if (DXInfoTracer.IsInfoEnabled())
     {
         for (int i = 0; i < indentLevel; i++)
         {
             message = "   " + message;
         }
         DXInfoTracer.TraceLine(DXInfoTracer.LogLevels.Info, message);
     }
 }
예제 #2
0
 public static void Error(int indentLevel, string format, params object[] args)
 {
     if (DXInfoTracer.IsErrorEnabled())
     {
         for (int i = 0; i < indentLevel; i++)
         {
             format = "   " + format;
         }
         DXInfoTracer.Error(string.Format(CultureInfo.InvariantCulture, format, args));
     }
 }
예제 #3
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);
     }
 }
예제 #4
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
            });
        }
예제 #5
0
 internal static void TraceCommandParameter(DbParameter parameter)
 {
     DXInfoTracer.TraceCommandParameter(1, parameter);
 }
예제 #6
0
 internal static void TraceCommandResultCount(int count)
 {
     DXInfoTracer.TraceCommandResultCount(1, count);
 }
예제 #7
0
 //internal static void TraceV1ReceivedAnchorOperation(string table, string operation, SyncAnchor anchorValue)
 //{
 //    if (DXInfoTracer.IsVerboseEnabled())
 //    {
 //        string text = "NULL";
 //        if (anchorValue != null && anchorValue.Anchor != null)
 //        {
 //            MemoryStream serializationStream = new MemoryStream(anchorValue.Anchor);
 //            BinaryFormatter binaryFormatter = new BinaryFormatter();
 //            object obj = binaryFormatter.Deserialize(serializationStream);
 //            byte[] array = obj as byte[];
 //            if (array != null)
 //            {
 //                text = BitConverter.ToString(array);
 //            }
 //            else
 //            {
 //                text = obj.ToString();
 //            }
 //        }
 //        DXInfoTracer.Verbose("{0}: {1} ReceivedAnchor value: {2}", new object[]
 //        {
 //            table,
 //            operation,
 //            text
 //        });
 //    }
 //}
 //internal static void TraceV1SentAnchorOperation(string table, string operation, SyncAnchor anchorValue)
 //{
 //    if (DXInfoTracer.IsVerboseEnabled())
 //    {
 //        string text = "NULL";
 //        if (anchorValue != null && anchorValue.Anchor != null)
 //        {
 //            text = BitConverter.ToUInt64(anchorValue.Anchor, 0).ToString(CultureInfo.InvariantCulture);
 //        }
 //        DXInfoTracer.Verbose("{0}: {1} SentAnchor value: {2}", new object[]
 //        {
 //            table,
 //            operation,
 //            text
 //        });
 //    }
 //}
 internal static void TraceCommandAndParameters(IDbCommand command)
 {
     DXInfoTracer.TraceCommandAndParameters(1, command);
 }