Table of Contents

Namespace Npgsql

Classes

NpgsqlBatch

Represents a batch of commands which can be executed against a data source in a single round trip. Provides a base class for database-specific classes that represent command batches.

NpgsqlBatchCommand

Represents a single command within a DbBatch. A batch can be executed against a data source in a single round trip.

NpgsqlBatchCommandCollection

The base class for a collection of instances of DbBatchCommand, contained in a DbBatch.

NpgsqlBinaryExporter

Provides an API for a binary COPY TO operation, a high-performance data export mechanism from a PostgreSQL table. Initiated by BeginBinaryExport(string)

NpgsqlBinaryImporter

Provides an API for a binary COPY FROM operation, a high-performance data import mechanism to a PostgreSQL table. Initiated by BeginBinaryImport(string)

NpgsqlCommand

Represents a SQL statement or function (stored procedure) to execute against a PostgreSQL database. This class cannot be inherited.

NpgsqlCommandBuilder

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

NpgsqlConnection

This class represents a connection to a PostgreSQL server.

NpgsqlConnectionStringBuilder

Provides a simple way to create and manage the contents of connection strings used by the NpgsqlConnection class.

NpgsqlCopyTextReader

Reader for a text export, initiated by BeginTextExport(string).

NpgsqlCopyTextWriter

Writer for a text import, initiated by BeginTextImport(string).

NpgsqlDataAdapter

This class represents an adapter from many commands: select, update, insert and delete to fill a DataSet.

NpgsqlDataReader

Reads a forward-only stream of rows from a data source.

NpgsqlDataSource

Represents a data source which can be used to obtain open connections, and against which commands can be executed directly.

NpgsqlDataSourceBuilder

Provides a simple API for configuring and creating an NpgsqlDataSource, from which database connections can be obtained.

NpgsqlEventId
NpgsqlException

The exception that is thrown when server-related issues occur.

NpgsqlFactory

A factory to create instances of various Npgsql objects.

NpgsqlLargeObjectManager

Large object manager. This class can be used to store very large files in a PostgreSQL database.

NpgsqlLargeObjectStream

An interface to remotely control the seekable stream for an opened large object on a PostgreSQL server. Note that the OpenRead/OpenReadWrite method as well as all operations performed on this stream must be wrapped inside a database transaction.

NpgsqlLoggingConfiguration

Configures Npgsql logging

NpgsqlMetricsOptions

Options to configure Npgsql's support for OpenTelemetry metrics. Currently no options are available.

NpgsqlMultiHostDataSource

An NpgsqlDataSource which manages connections for multiple hosts, is aware of their states (primary, secondary, offline...) and can perform failover and load balancing across them.

NpgsqlNestedDataReader

Reads a forward-only stream of rows from a nested data source. Can be retrieved using GetData(int) or GetData(int).

NpgsqlNoticeEventArgs

Provides data for a PostgreSQL notice event.

NpgsqlNotificationEventArgs

Provides information on a PostgreSQL notification. Notifications are sent when your connection has registered for notifications on a specific channel via the LISTEN command. NOTIFY can be used to generate such notifications, allowing for an inter-connection communication channel.

NpgsqlOperationInProgressException

Thrown when trying to use a connection that is already busy performing some other operation. Provides information on the already-executing operation to help with debugging.

NpgsqlParameter

This class represents a parameter to a command that will be sent to server

NpgsqlParameterCollection

Represents a collection of parameters relevant to a NpgsqlCommand as well as their respective mappings to columns in a DataSet.

NpgsqlParameter<T>

A generic version of NpgsqlParameter which provides more type safety and avoids boxing of value types. Use TypedValue instead of Value.

NpgsqlRawCopyStream

Provides an API for a raw binary COPY operation, a high-performance data import/export mechanism to a PostgreSQL table. Initiated by BeginRawBinaryCopy(string)

NpgsqlRowUpdatedEventArgs
NpgsqlRowUpdatingEventArgs
NpgsqlSlimDataSourceBuilder

Provides a simple API for configuring and creating an NpgsqlDataSource, from which database connections can be obtained.

NpgsqlTracingOptions

Options to configure Npgsql's support for OpenTelemetry tracing.

NpgsqlTransaction

Represents a transaction to be made in a PostgreSQL database. This class cannot be inherited.

PostgresErrorCodes

Provides constants for PostgreSQL error codes.

PostgresException

The exception that is thrown when the PostgreSQL backend reports errors (e.g. query SQL issues, constraint violations).

PostgresNotice

PostgreSQL notices are non-critical messages generated by PostgreSQL, either as a result of a user query (e.g. as a warning or informational notice), or due to outside activity (e.g. if the database administrator initiates a "fast" database shutdown).

Interfaces

INpgsqlNameTranslator

A component which translates a CLR name (e.g. SomeClass) into a database name (e.g. some_class) according to some scheme. Used for mapping enum and composite types.

Enums

ArrayNullabilityMode

Specifies how the mapping of arrays of value types behaves with respect to nullability when they are requested via an API returning an object.

ChannelBinding

Specifies how to manage channel binding.

ServerCompatibilityMode

An option specified in the connection string that activates special compatibility features.

SslMode

Specifies how to manage SSL.

SslNegotiation

Specifies how to initialize SSL session.

StatementType

Specifies the type of SQL statement, e.g. SELECT

TargetSessionAttributes

Specifies server type preference.

Delegates

NoticeEventHandler

Represents a method that handles the Notice event.

NotificationEventHandler

Represents a method that handles the Notification event.

NpgsqlRowUpdatedEventHandler

Represents the method that handles the RowUpdated events.

NpgsqlRowUpdatingEventHandler

Represents the method that handles the RowUpdating events.

ProvideClientCertificatesCallback

Represents a method that allows the application to provide a certificate collection to be used for SSL client authentication

ProvidePasswordCallback

Represents a method that allows the application to provide a password at connection time in code rather than configuration