Search Results for

    Show / Hide Table of Contents

    Class NpgsqlCommandBuilder

    This class creates database commands for automatic insert, update and delete operations.

    Inheritance
    Object
    MarshalByRefObject
    Component
    DbCommandBuilder
    NpgsqlCommandBuilder
    Implements
    IComponent
    IDisposable
    Inherited Members
    DbCommandBuilder.Dispose(Boolean)
    DbCommandBuilder.GetSchemaTable(DbCommand)
    DbCommandBuilder.InitializeCommand(DbCommand)
    DbCommandBuilder.RefreshSchema()
    DbCommandBuilder.RowUpdatingHandler(RowUpdatingEventArgs)
    DbCommandBuilder.CatalogLocation
    DbCommandBuilder.CatalogSeparator
    DbCommandBuilder.ConflictOption
    DbCommandBuilder.DataAdapter
    DbCommandBuilder.SchemaSeparator
    DbCommandBuilder.SetAllValues
    Component.Dispose()
    Component.GetService(Type)
    Component.ToString()
    Component.CanRaiseEvents
    Component.Container
    Component.DesignMode
    Component.Events
    Component.Site
    Component.Disposed
    MarshalByRefObject.GetLifetimeService()
    MarshalByRefObject.InitializeLifetimeService()
    MarshalByRefObject.MemberwiseClone(Boolean)
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Namespace: Npgsql
    Assembly: Npgsql.dll
    Syntax
    public sealed class NpgsqlCommandBuilder : DbCommandBuilder, IComponent, IDisposable

    Constructors

    | Improve this Doc View Source

    NpgsqlCommandBuilder()

    Initializes a new instance of the NpgsqlCommandBuilder class.

    Declaration
    public NpgsqlCommandBuilder()
    | Improve this Doc View Source

    NpgsqlCommandBuilder(NpgsqlDataAdapter)

    Initializes a new instance of the NpgsqlCommandBuilder class.

    Declaration
    public NpgsqlCommandBuilder(NpgsqlDataAdapter adapter)
    Parameters
    Type Name Description
    NpgsqlDataAdapter adapter

    The adapter.

    Properties

    | Improve this Doc View Source

    QuotePrefix

    Gets or sets the beginning character or characters to use when specifying database objects (for example, tables or columns) whose names contain characters such as spaces or reserved tokens.

    Declaration
    public override string QuotePrefix { get; set; }
    Property Value
    Type Description
    String

    The beginning character or characters to use. The default is an empty string.

    Overrides
    DbCommandBuilder.QuotePrefix
    | Improve this Doc View Source

    QuoteSuffix

    Gets or sets the ending character or characters to use when specifying database objects (for example, tables or columns) whose names contain characters such as spaces or reserved tokens.

    Declaration
    public override string QuoteSuffix { get; set; }
    Property Value
    Type Description
    String

    The ending character or characters to use. The default is an empty string.

    Overrides
    DbCommandBuilder.QuoteSuffix

    Methods

    | Improve this Doc View Source

    ApplyParameterInfo(DbParameter, DataRow, StatementType, Boolean)

    Applies the parameter information.

    Declaration
    protected override void ApplyParameterInfo(DbParameter p, DataRow row, StatementType statementType, bool whereClause)
    Parameters
    Type Name Description
    DbParameter p

    The parameter.

    DataRow row

    The row.

    StatementType statementType

    Type of the statement.

    Boolean whereClause

    If set to true [where clause].

    Overrides
    DbCommandBuilder.ApplyParameterInfo(DbParameter, DataRow, StatementType, Boolean)
    | Improve this Doc View Source

    DeriveParameters(NpgsqlCommand)

    This method is responsible to derive the command parameter list with values obtained from function definition. It clears the Parameters collection of command. Also, if there is any parameter type which is not supported by Npgsql, an InvalidOperationException will be thrown. Parameters name will be parameter1, parameter2, ... for CommandType.StoredProcedure and named after the placeholder for CommandType.Text

    Declaration
    public static void DeriveParameters(NpgsqlCommand command)
    Parameters
    Type Name Description
    NpgsqlCommand command

    NpgsqlCommand whose function parameters will be obtained.

    | Improve this Doc View Source

    GetDeleteCommand()

    Gets the automatically generated System.Data.Common.DbCommand object required to perform deletions at the data source.

    Declaration
    public NpgsqlCommand GetDeleteCommand()
    Returns
    Type Description
    NpgsqlCommand

    The automatically generated System.Data.Common.DbCommand object required to perform deletions.

    | Improve this Doc View Source

    GetDeleteCommand(Boolean)

    Gets the automatically generated NpgsqlCommand object required to perform deletions at the data source, optionally using columns for parameter names.

    Declaration
    public NpgsqlCommand GetDeleteCommand(bool useColumnsForParameterNames)
    Parameters
    Type Name Description
    Boolean useColumnsForParameterNames

    If true, generate parameter names matching column names, if possible. If false, generate @p1, @p2, and so on.

    Returns
    Type Description
    NpgsqlCommand

    The automatically generated NpgsqlCommand object required to perform deletions.

    | Improve this Doc View Source

    GetInsertCommand()

    Gets the automatically generated NpgsqlCommand object required to perform insertions at the data source.

    Declaration
    public NpgsqlCommand GetInsertCommand()
    Returns
    Type Description
    NpgsqlCommand

    The automatically generated NpgsqlCommand object required to perform insertions.

    | Improve this Doc View Source

    GetInsertCommand(Boolean)

    Gets the automatically generated NpgsqlCommand object required to perform insertions at the data source, optionally using columns for parameter names.

    Declaration
    public NpgsqlCommand GetInsertCommand(bool useColumnsForParameterNames)
    Parameters
    Type Name Description
    Boolean useColumnsForParameterNames

    If true, generate parameter names matching column names, if possible. If false, generate @p1, @p2, and so on.

    Returns
    Type Description
    NpgsqlCommand

    The automatically generated NpgsqlCommand object required to perform insertions.

    | Improve this Doc View Source

    GetParameterName(Int32)

    Returns the name of the specified parameter in the format of @p#.

    Declaration
    protected override string GetParameterName(int parameterOrdinal)
    Parameters
    Type Name Description
    Int32 parameterOrdinal

    The number to be included as part of the parameter's name..

    Returns
    Type Description
    String

    The name of the parameter with the specified number appended as part of the parameter name.

    Overrides
    DbCommandBuilder.GetParameterName(Int32)
    | Improve this Doc View Source

    GetParameterName(String)

    Returns the full parameter name, given the partial parameter name.

    Declaration
    protected override string GetParameterName(string parameterName)
    Parameters
    Type Name Description
    String parameterName

    The partial name of the parameter.

    Returns
    Type Description
    String

    The full parameter name corresponding to the partial parameter name requested.

    Overrides
    DbCommandBuilder.GetParameterName(String)
    | Improve this Doc View Source

    GetParameterPlaceholder(Int32)

    Returns the placeholder for the parameter in the associated SQL statement.

    Declaration
    protected override string GetParameterPlaceholder(int parameterOrdinal)
    Parameters
    Type Name Description
    Int32 parameterOrdinal

    The number to be included as part of the parameter's name.

    Returns
    Type Description
    String

    The name of the parameter with the specified number appended.

    Overrides
    DbCommandBuilder.GetParameterPlaceholder(Int32)
    | Improve this Doc View Source

    GetUpdateCommand()

    Gets the automatically generated System.Data.Common.DbCommand object required to perform updates at the data source.

    Declaration
    public NpgsqlCommand GetUpdateCommand()
    Returns
    Type Description
    NpgsqlCommand

    The automatically generated System.Data.Common.DbCommand object required to perform updates.

    | Improve this Doc View Source

    GetUpdateCommand(Boolean)

    Gets the automatically generated NpgsqlCommand object required to perform updates at the data source, optionally using columns for parameter names.

    Declaration
    public NpgsqlCommand GetUpdateCommand(bool useColumnsForParameterNames)
    Parameters
    Type Name Description
    Boolean useColumnsForParameterNames

    If true, generate parameter names matching column names, if possible. If false, generate @p1, @p2, and so on.

    Returns
    Type Description
    NpgsqlCommand

    The automatically generated NpgsqlCommand object required to perform updates.

    | Improve this Doc View Source

    QuoteIdentifier(String)

    Given an unquoted identifier in the correct catalog case, returns the correct quoted form of that identifier, including properly escaping any embedded quotes in the identifier.

    Declaration
    public override string QuoteIdentifier(string unquotedIdentifier)
    Parameters
    Type Name Description
    String unquotedIdentifier

    The original unquoted identifier.

    Returns
    Type Description
    String

    The quoted version of the identifier. Embedded quotes within the identifier are properly escaped.

    Overrides
    DbCommandBuilder.QuoteIdentifier(String)
    Exceptions
    Type Condition
    ArgumentNullException

    Unquoted identifier parameter cannot be null

    | Improve this Doc View Source

    SetRowUpdatingHandler(DbDataAdapter)

    Registers the NpgsqlCommandBuilder to handle the RowUpdating event for a NpgsqlDataAdapter.

    Declaration
    protected override void SetRowUpdatingHandler(DbDataAdapter adapter)
    Parameters
    Type Name Description
    DbDataAdapter adapter

    The DbDataAdapter to be used for the update.

    Overrides
    DbCommandBuilder.SetRowUpdatingHandler(DbDataAdapter)
    | Improve this Doc View Source

    UnquoteIdentifier(String)

    Given a quoted identifier, returns the correct unquoted form of that identifier, including properly un-escaping any embedded quotes in the identifier.

    Declaration
    public override string UnquoteIdentifier(string quotedIdentifier)
    Parameters
    Type Name Description
    String quotedIdentifier

    The identifier that will have its embedded quotes removed.

    Returns
    Type Description
    String

    The unquoted identifier, with embedded quotes properly un-escaped.

    Overrides
    DbCommandBuilder.UnquoteIdentifier(String)
    Exceptions
    Type Condition
    ArgumentNullException

    Quoted identifier parameter cannot be null

    Implements

    System.ComponentModel.IComponent
    System.IDisposable
    • Improve this Doc
    • View Source
    In This Article
    Back to top © Copyright 2022 The Npgsql Development Team