Table of Contents

Class PgConversionContext

Namespace
Npgsql.Internal
Assembly
Npgsql.dll

Connection/options-scoped state that flows into a converter across operations (descriptor query, read, write, bind). Carries session state the converter may need (today: TextEncoding for text-format converters; future: dynamic per-connection state). One instance is shared across all callers within the same scope, so consumers must treat it as a read-through reference and avoid per-call allocation.

[Experimental("NPG9001")]
public sealed class PgConversionContext
Inheritance
PgConversionContext
Inherited Members

Properties

Empty

An empty context, suitable for inner probes that don't read any session state.

public static PgConversionContext Empty { get; }

Property Value

PgConversionContext

TextEncoding

The text encoding for this context. Defaults to UTF-8 — the substrate's default and the only encoding for which no fallback semantics are needed. Always set; converters can read it unconditionally without null-checking.

public Encoding TextEncoding { get; init; }

Property Value

Encoding