Example #1
0
        internal static void Write(TextWriter stream, CommandBuiltEventArgs e)
        {
            if (stream == null)
            {
                Debug.WriteLine("Command Text: " + e.Command.CommandText);
#if !WINDOWS_UWP && !NETSTANDARD1_3
                Debug.Indent();
#endif
                foreach (DbParameter parameter in e.Command.Parameters)
                {
                    var valueText = (parameter.Value == null || parameter.Value == DBNull.Value) ? "<NULL>" : parameter.Value.ToString();
                    Debug.WriteLine($"Parameter: {parameter.ParameterName} = {valueText}");
                }
#if !WINDOWS_UWP && !NETSTANDARD1_3
                Debug.Unindent();
#endif
            }
            else
            {
                stream.WriteLine("Command Text: " + e.Command.CommandText);

                foreach (DbParameter parameter in e.Command.Parameters)
                {
                    var valueText = (parameter.Value == null || parameter.Value == DBNull.Value) ? "<NULL>" : parameter.Value.ToString();
                    stream.WriteLine($"    Parameter: {parameter.ParameterName} = {valueText}");
                }
            }
        }
Example #2
0
 /// <summary>
 /// Override this if you want to examine or modify the DBCommand before it is executed.
 /// </summary>
 /// <param name="e">The <see cref="CommandBuiltEventArgs" /> instance containing the event data.</param>
 protected override void OnCommandBuilt(CommandBuiltEventArgs e)
 {
     if (e == null)
     {
         throw new ArgumentNullException("e", "e is null.");
     }
     e.Command.CommandTimeout = (int)m_Timeout.TotalSeconds;
 }
Example #3
0
    /// <summary>
    /// Override this if you want to examine or modify the DBCommand before it is executed.
    /// </summary>
    /// <param name="e">The <see cref="CommandBuiltEventArgs" /> instance containing the event data.</param>
    protected override void OnCommandBuilt(CommandBuiltEventArgs e)
    {
        if (m_Stream == null)
        {
            Debug.WriteLine("Command Text: " + e.Command.CommandText);
            Debug.Indent();
            foreach (var parameter in e.Command.Parameters.Enumerate())
            {
                var valueText = (parameter.Value == null || parameter.Value == DBNull.Value) ? "<NULL>" : parameter.Value.ToString();
                Debug.WriteLine($"Parameter: {parameter.ParameterName} = {valueText}");
            }
            Debug.Unindent();
        }
        else
        {
            m_Stream.WriteLine("Command Text: " + e.Command.CommandText);

            foreach (var parameter in e.Command.Parameters.Enumerate())
            {
                var valueText = (parameter.Value == null || parameter.Value == DBNull.Value) ? "<NULL>" : parameter.Value.ToString();
                m_Stream.WriteLine($"    Parameter: {parameter.ParameterName} = {valueText}");
            }
        }
    }
Example #4
0
 /// <summary>
 /// Override this if you want to examine or modify the DBCommand before it is executed.
 /// </summary>
 /// <param name="e">The <see cref="CommandBuiltEventArgs"/> instance containing the event data.</param>
 protected virtual void OnCommandBuilt(CommandBuiltEventArgs e)
 {
 }
Example #5
0
 void ExecutionToken_CommandBuilt(object?sender, CommandBuiltEventArgs e)
 {
     OnCommandBuilt(e);
 }
Example #6
0
 /// <summary>
 /// Override this if you want to examine or modify the DBCommand before it is executed.
 /// </summary>
 /// <param name="e">The <see cref="CommandBuiltEventArgs" /> instance containing the event data.</param>
 protected override void OnCommandBuilt(CommandBuiltEventArgs e)
 {
     Write(m_Stream, e);
 }