Struct BindContext
[Experimental("NPG9001")]
public readonly struct BindContext
- Inherited Members
Properties
BufferRequirement
The size requirement for writing values with Format. Sourced from the format-specific Write returned by GetDescriptor(in DescriptorContext).
public Size BufferRequirement { get; }
Property Value
ConversionContext
The conversion context active for this bind. Forwarded through nested binds; populated from the writer at the outermost bind so composing converters can resolve context-dependent inner descriptors against the same context the eventual Write operation will see.
public PgConversionContext ConversionContext { get; }
Property Value
Format
The data format selected for this bind.
public DataFormat Format { get; }
Property Value
IsBindFixedSize
True when BufferRequirement is value-independent — every value's size equals
BufferRequirement. Composing converters use this to compute closed-form aggregate
sizes without per-element ledgers, even when Bind must still be called for side effects
(validation, etc.). Synthesized from Kind being Exact.
public bool IsBindFixedSize { get; }
Property Value
IsBindOptional
When true, composing converters may use BufferRequirement directly and skip the nested Bind call entirely.
Bind can be called anyway at which point it just short-circuits, without invoking BindValue. Implies IsBindFixedSize.
Sourced from the format-specific IsBindOptional returned by GetDescriptor(in DescriptorContext).
public bool IsBindOptional { get; }
Property Value
NestedObjectDbNullHandling
The policy for how nested object-typed values should have their database null-shaped values handled during this bind. See NestedObjectDbNullHandling for per-mode semantics.
public NestedObjectDbNullHandling NestedObjectDbNullHandling { get; init; }
Property Value
Methods
CreateNested(in BindContext, BufferRequirements)
Variant of CreateNested(in BindContext, PgConverter) for callers that already hold the inner converter's BufferRequirements (e.g. composing converters that captured them in their constructor). Skips the per-call GetDescriptor(in DescriptorContext) roundtrip.
public static BindContext CreateNested(in BindContext nestingContext, BufferRequirements requirements)
Parameters
nestingContextBindContextrequirementsBufferRequirements
Returns
CreateNested(in BindContext, PgConverter)
Constructs a BindContext from a converter info, propagating relevant context from nestingContext.
Composing converters (arrays, ranges, multiranges, composites, etc.) use this to thread any policy through to nested binds.
public static BindContext CreateNested(in BindContext nestingContext, PgConverter converter)
Parameters
nestingContextBindContextconverterPgConverter
Returns
CreateUnchecked(DataFormat, Size, bool, PgConversionContext?)
Constructs a BindContext from caller-supplied values without verifying that
bufferRequirement and isBindOptional match the converter's
cached requirements. Callers must ensure these values are consistent with the converter that
will receive this context.
public static BindContext CreateUnchecked(DataFormat format, Size bufferRequirement, bool isBindOptional, PgConversionContext? conversionContext = null)
Parameters
formatDataFormatbufferRequirementSizeisBindOptionalboolconversionContextPgConversionContext