/// <summary> /// Used to show an SQL statement with actual values for debugging or logging to a file. /// </summary> /// <param name="pCommand">Command object</param> /// <param name="pFileName">Path and file name to write SQL statement to</param> /// <param name="pProvider">Data provider e.g. SQL-Server, MS-Access</param> /// <param name="pQualifier">Character which denotes a query parameter e.g. @ for SQL-Server, : or Oracle</param> /// <returns>Command object command text with parameter values using <seealso cref="ActualCommandText"/></returns> public static void RevealCommandQueryToFile(this IDbCommand pCommand, string pFileName, CommandProvider pProvider = CommandProvider.SqlServer, string pQualifier = "@") { File.WriteAllText(pFileName, pCommand.ActualCommandText(pProvider, pQualifier)); }
/// <summary> /// Used to show an SQL statement with actual values for debugging or logging to a file. /// </summary> /// <param name="pCommand">Command object</param> /// <param name="pProvider">Data provider e.g. SQL-Server, MS-Access</param> /// <param name="pQualifier">Character which denotes a query parameter e.g. @ for SQL-Server, : or Oracle</param> /// <returns>Command object command text with parameter values using <seealso cref="ActualCommandText"/></returns> public static string RevealCommandQuery(this IDbCommand pCommand, CommandProvider pProvider = CommandProvider.SqlServer, string pQualifier = "@") { return(pCommand.ActualCommandText(pProvider, pQualifier)); }