/// <summary> /// Initializes a new instance of the <see cref="SqlWriter"/> class that writes to the /// specified <see cref="StringBuilder"/> using the specified <see cref="SqlDialect" /> and /// <paramref name="settings"/>. /// </summary> /// <param name="builder"> /// The <see cref="StringBuilder"/> to write to. /// </param> /// <param name="dialect"> /// The <see cref="SqlDialect"/> to use while writing. /// </param> /// <param name="settings"> /// The <see cref="SqlWriterSettings"/> object used to configure the new <see cref="SqlWriter"/> /// instance. If this <see langword="null"/>, a <see cref="SqlWriterSettings"/> object with default /// settings is used. /// </param> /// <exception cref="ArgumentNullException"> /// Thrown when the <paramref name="builder"/> or <paramref name="dialect"/> argument is <see langword="null"/>. /// </exception> public SqlWriter(StringBuilder builder, SqlDialect dialect, SqlWriterSettings settings) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (dialect == null) { throw new ArgumentNullException(nameof(dialect)); } if (settings == null) { settings = new SqlWriterSettings(); } _writer = new StringWriter(builder, CultureInfo.InvariantCulture); _canDisposeWriter = true; Dialect = dialect; Settings = settings; }
/// <summary> /// Initializes a new instance of the <see cref="SqlWriter"/> class that writes to the /// specified <see cref="TextWriter"/> using the specified <see cref="SqlDialect" /> and /// <paramref name="settings"/>. /// </summary> /// <param name="writer"> /// The <see cref="TextWriter"/> to write to. /// </param> /// <param name="dialect"> /// The <see cref="SqlDialect"/> to use while writing. /// </param> /// <param name="settings"> /// The <see cref="SqlWriterSettings"/> object used to configure the new <see cref="SqlWriter"/> /// instance. If this <see langword="null"/>, a <see cref="SqlWriterSettings"/> object with default /// settings is used. /// </param> /// <exception cref="ArgumentNullException"> /// Thrown when the <paramref name="writer"/> or <paramref name="dialect"/> argument is <see langword="null"/>. /// </exception> public SqlWriter(TextWriter writer, SqlDialect dialect, SqlWriterSettings settings) { if (writer == null) { throw new ArgumentNullException(nameof(writer)); } if (dialect == null) { throw new ArgumentNullException(nameof(dialect)); } if (settings == null) { settings = new SqlWriterSettings(); } _writer = writer; _canDisposeWriter = false; Dialect = dialect; Settings = settings; }
/// <summary> /// Initializes a new instance of the <see cref="SqlWriter"/> class that writes to the /// specified <see cref="StringBuilder"/> using the specified <paramref name="settings"/>. /// </summary> /// <param name="builder"> /// The <see cref="StringBuilder"/> to write to. /// </param> /// <param name="settings"> /// The <see cref="SqlWriterSettings"/> object used to configure the new <see cref="SqlWriter"/> /// instance. If this <see langword="null"/>, a <see cref="SqlWriterSettings"/> object with default /// settings is used. /// </param> /// <exception cref="ArgumentNullException"> /// Thrown when the <paramref name="builder"/> argument is <see langword="null"/>. /// </exception> public SqlWriter(StringBuilder builder, SqlWriterSettings settings) : this(builder, SqlDialect.Current, settings) { }
/// <summary> /// Initializes a new instance of the <see cref="SqlWriter"/> class that writes to the /// specified <see cref="TextWriter"/> using the specified <paramref name="settings"/>. /// </summary> /// <param name="writer"> /// The <see cref="TextWriter"/> to write to. /// </param> /// <param name="settings"> /// The <see cref="SqlWriterSettings"/> object used to configure the new <see cref="SqlWriter"/> /// instance. If this <see langword="null"/>, a <see cref="SqlWriterSettings"/> object with default /// settings is used. /// </param> /// <exception cref="ArgumentNullException"> /// Thrown when the <paramref name="writer"/> argument is <see langword="null"/>. /// </exception> public SqlWriter(TextWriter writer, SqlWriterSettings settings) : this(writer, SqlDialect.Current, settings) { }