Click or drag to resize

Neon.Postgres Namespace

This namespace includes Postgres related extensions and utilities.
Classes
  ClassDescription
Public classConnectionExtensions
Extends NpgsqlConnection with useful methods.
Public classDatabaseStatus
Holds information about a database's schema as returned by GetStatusAsync.
Public classPreparedCommand
Simplifies prepared Postgres command usage by combining the prepared command and its usage into a single type. It's also often useful to create derived custom types from this that handle the parameter definitions and subsitutions and perhaps precompute result column indexes to help abstract these details from the calling program.
Public classReaderExtensions
Extends NpgsqlDataReader with useful methods.
Public classSchemaManager
Manages the initial creation and schema updates for a Postgres database.
Public classSchemaManagerException
Thrown by SchemaManager when a problem is detected.
Structures
  StructureDescription
Public structureReaderAsyncEnumerator
Returned by ToAsyncEnumerable(NpgsqlDataReader) making it possible to asynchronously enumerate the reader rows via the C# await foreach statement or the equivalent for other .NET languages.
Public structureReaderEnumerator
Returned by ToEnumerable(NpgsqlDataReader) making it possible to synchronously enumerate the reader rows via the C# foreach statement or the equivalent for other .NET languages.
Enumerations
  EnumerationDescription
Public enumerationSchemaStatus
Enumerates the possible database states as returned by GetStatusAsync.
Remarks

ConnectionExtensions extends NpgsqlConnection with

OpenDatabase(NpgsqlConnection, String) Clones the current connection and then connection to a new database
ExecuteNonQuery(NpgsqlConnection, String, NpgsqlTransaction) A shortcut for executing a non-query directly on a connection without having to create a NpgsqlCommand first.
ExecuteScalar(NpgsqlConnection, String, NpgsqlTransaction) A shortcut for executing a scalar query directly on a connection without having to create a NpgsqlCommand first.
ExecuteReader(NpgsqlConnection, String, CommandBehavior, NpgsqlTransaction) A shortcut for executing a query directly on a connection without having to create a NpgsqlCommand first.
ExecuteReaderAsync(NpgsqlConnection, String, CommandBehavior, CancellationToken, NpgsqlTransaction) A shortcut for asynchronously executing a query directly on a connection without having to create a NpgsqlCommand first. This method calls an action for each row returned by the query.
ExecuteBatch(NpgsqlConnection, String, NpgsqlTransaction) Executes a batch of SQL commands separated by go lines. This allows you to have a single script to do things like creating a table and then initializing it. This is a convenience that is similar to how some Microsoft SQL Server tooling works.

Asynchronous versions of these methods are also available.

SchemaManager is designed to help manage initial database deployment as well as subsequent updates as your database schema changes over time.

ReaderExtensions extends the NpgsqlDataReader class by adding methods to enumerate results using C# foreach as well as methods to fetch nullable column values.