/// <summary>Gets a <see cref="string"/> representation of the SQL statement.</summary> /// <param name="sqlStatement"> /// The SQL statement to represent as <see cref="string"/>. /// </param> /// <param name="formatInfo"> /// The format info to use. /// </param> /// <remarks> /// Uses the <see cref="SqlBuilderPool"/> to minimize <see cref="SqlBuilder"/> /// (and by that <see cref="System.Text.StringBuilder"/>) construction and /// destruction. /// </remarks> public static string ToString(this ISqlStatement sqlStatement, SqlFormatInfo formatInfo) { var builder = SqlBuilder.Pool.Pop(); builder.FormatInfo = formatInfo; sqlStatement.Write(builder); var sql = builder.ToString(); SqlBuilder.Pool.Push(builder); return(sql); }
public static void GuardsSqlBuilder(ISqlStatement statement) { Assert.NotNull(statement); Assert.Throws <ArgumentNullException>(() => statement.Write(null)); }