Search Results for

    Show / Hide Table of Contents

    Class NpgsqlBatch

    Inheritance
    object
    DbBatch
    NpgsqlBatch
    Implements
    IAsyncDisposable
    Inherited Members
    DbBatch.DisposeAsync()
    Namespace: Npgsql
    Assembly: Npgsql.dll
    Syntax
    public class NpgsqlBatch : DbBatch, IAsyncDisposable

    Constructors

    | Improve this Doc View Source

    NpgsqlBatch(NpgsqlConnection?, NpgsqlTransaction?)

    Initializes a new NpgsqlBatch.

    Declaration
    public NpgsqlBatch(NpgsqlConnection? connection = null, NpgsqlTransaction? transaction = null)
    Parameters
    Type Name Description
    NpgsqlConnection connection

    A NpgsqlConnection that represents the connection to a PostgreSQL server.

    NpgsqlTransaction transaction

    The NpgsqlTransaction in which the NpgsqlCommand executes.

    Properties

    | Improve this Doc View Source

    BatchCommands

    Declaration
    public NpgsqlBatchCommandCollection BatchCommands { get; }
    Property Value
    Type Description
    NpgsqlBatchCommandCollection
    | Improve this Doc View Source

    Connection

    Declaration
    public NpgsqlConnection? Connection { get; set; }
    Property Value
    Type Description
    NpgsqlConnection
    | Improve this Doc View Source

    DbBatchCommands

    Declaration
    protected override DbBatchCommandCollection DbBatchCommands { get; }
    Property Value
    Type Description
    DbBatchCommandCollection
    Overrides
    DbBatch.DbBatchCommands
    | Improve this Doc View Source

    DbConnection

    Declaration
    protected override DbConnection? DbConnection { get; set; }
    Property Value
    Type Description
    DbConnection?
    Overrides
    DbBatch.DbConnection
    | Improve this Doc View Source

    DbTransaction

    Declaration
    protected override DbTransaction? DbTransaction { get; set; }
    Property Value
    Type Description
    DbTransaction?
    Overrides
    DbBatch.DbTransaction
    | Improve this Doc View Source

    EnableErrorBarriers

    Controls whether to place error barriers between all batch commands within this batch. Default to false.

    Declaration
    public bool EnableErrorBarriers { get; set; }
    Property Value
    Type Description
    bool
    Remarks

    By default, any exception in a command causes later commands in the batch to be skipped, and earlier commands to be rolled back. Enabling error barriers ensures that errors do not affect other commands in the batch.

    Note that if the batch is executed within an explicit transaction, the first error places the transaction in a failed state, causing all later commands to fail in any case. As a result, this option is useful mainly when there is no explicit transaction.

    At the PostgreSQL wire protocol level, this corresponds to inserting a Sync message between each command, rather than grouping all the batch's commands behind a single terminating Sync.

    To control error barriers on a command-by-command basis, see AppendErrorBarrier.

    | Improve this Doc View Source

    Timeout

    Declaration
    public override int Timeout { get; set; }
    Property Value
    Type Description
    int
    Overrides
    DbBatch.Timeout
    | Improve this Doc View Source

    Transaction

    Declaration
    public NpgsqlTransaction? Transaction { get; set; }
    Property Value
    Type Description
    NpgsqlTransaction

    Methods

    | Improve this Doc View Source

    Cancel()

    Declaration
    public override void Cancel()
    Overrides
    DbBatch.Cancel()
    | Improve this Doc View Source

    CreateBatchCommand()

    Declaration
    public NpgsqlBatchCommand CreateBatchCommand()
    Returns
    Type Description
    NpgsqlBatchCommand
    | Improve this Doc View Source

    CreateDbBatchCommand()

    Declaration
    protected override DbBatchCommand CreateDbBatchCommand()
    Returns
    Type Description
    DbBatchCommand
    Overrides
    DbBatch.CreateDbBatchCommand()
    | Improve this Doc View Source

    Dispose()

    Declaration
    public override void Dispose()
    Overrides
    DbBatch.Dispose()
    | Improve this Doc View Source

    ExecuteDbDataReader(CommandBehavior)

    Declaration
    protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)
    Parameters
    Type Name Description
    CommandBehavior behavior
    Returns
    Type Description
    DbDataReader
    Overrides
    DbBatch.ExecuteDbDataReader(CommandBehavior)
    | Improve this Doc View Source

    ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken)

    Declaration
    protected override Task<DbDataReader> ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    CommandBehavior behavior
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<><DbDataReader>
    Overrides
    DbBatch.ExecuteDbDataReaderAsync(CommandBehavior, CancellationToken)
    | Improve this Doc View Source

    ExecuteNonQuery()

    Declaration
    public override int ExecuteNonQuery()
    Returns
    Type Description
    int
    Overrides
    DbBatch.ExecuteNonQuery()
    | Improve this Doc View Source

    ExecuteNonQueryAsync(CancellationToken)

    Declaration
    public override Task<int> ExecuteNonQueryAsync(CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<><int>
    Overrides
    DbBatch.ExecuteNonQueryAsync(CancellationToken)
    | Improve this Doc View Source

    ExecuteReader(CommandBehavior)

    Declaration
    public NpgsqlDataReader ExecuteReader(CommandBehavior behavior = null)
    Parameters
    Type Name Description
    CommandBehavior behavior
    Returns
    Type Description
    NpgsqlDataReader
    | Improve this Doc View Source

    ExecuteReaderAsync(CancellationToken)

    Declaration
    public Task<NpgsqlDataReader> ExecuteReaderAsync(CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<><NpgsqlDataReader>
    | Improve this Doc View Source

    ExecuteReaderAsync(CommandBehavior, CancellationToken)

    Declaration
    public Task<NpgsqlDataReader> ExecuteReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    CommandBehavior behavior
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<><NpgsqlDataReader>
    | Improve this Doc View Source

    ExecuteScalar()

    Declaration
    public override object? ExecuteScalar()
    Returns
    Type Description
    object?
    Overrides
    DbBatch.ExecuteScalar()
    | Improve this Doc View Source

    ExecuteScalarAsync(CancellationToken)

    Declaration
    public override Task<object?> ExecuteScalarAsync(CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<><object?>
    Overrides
    DbBatch.ExecuteScalarAsync(CancellationToken)
    | Improve this Doc View Source

    Prepare()

    Declaration
    public override void Prepare()
    Overrides
    DbBatch.Prepare()
    | Improve this Doc View Source

    PrepareAsync(CancellationToken)

    Declaration
    public override Task PrepareAsync(CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    Task
    Overrides
    DbBatch.PrepareAsync(CancellationToken)

    Implements

    IAsyncDisposable
    • Improve this Doc
    • View Source
    In This Article
    Back to top © Copyright 2023 The Npgsql Development Team