Search Results for

    Show / Hide Table of Contents

    Class RangeHandler<TSubtype1, TSubtype2>

    Type handler for PostgreSQL range types.

    Inheritance
    Object
    NpgsqlTypeHandler
    RangeHandler<TSubtype1>
    RangeHandler<TSubtype1, TSubtype2>
    Implements
    INpgsqlTypeHandler<NpgsqlRange<TSubtype1>>
    INpgsqlTypeHandler<NpgsqlRange<TSubtype2>>
    Inherited Members
    RangeHandler<TSubtype1>.SubtypeHandler
    RangeHandler<TSubtype1>.GetFieldType(FieldDescription)
    RangeHandler<TSubtype1>.GetProviderSpecificFieldType(FieldDescription)
    RangeHandler<TSubtype1>.CreateArrayHandler(PostgresArrayType, ArrayNullabilityMode)
    RangeHandler<TSubtype1>.CreateRangeHandler(PostgresType)
    RangeHandler<TSubtype1>.CreateMultirangeHandler(PostgresMultirangeType)
    RangeHandler<TSubtype1>.Read(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
    RangeHandler<TSubtype1>.ReadRange<TAnySubtype>(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
    RangeHandler<TSubtype1>.ReadAsObject(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
    RangeHandler<TSubtype1>.ValidateAndGetLength(NpgsqlRange<TSubtype1>, NpgsqlLengthCache, NpgsqlParameter)
    RangeHandler<TSubtype1>.ValidateAndGetLengthRange<TAnySubtype>(NpgsqlRange<TAnySubtype>, NpgsqlLengthCache, NpgsqlParameter)
    RangeHandler<TSubtype1>.Write(NpgsqlRange<TSubtype1>, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean, CancellationToken)
    RangeHandler<TSubtype1>.WriteRange<TAnySubtype>(NpgsqlRange<TAnySubtype>, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean, CancellationToken)
    NpgsqlTypeHandler.PostgresType
    NpgsqlTypeHandler.Read<TAny>(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
    NpgsqlTypeHandler.Read<TAny>(NpgsqlReadBuffer, Int32, FieldDescription)
    NpgsqlTypeHandler.ReadCustom<TAny>(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
    NpgsqlTypeHandler.ValidateAndGetLength<TAny>(TAny, NpgsqlLengthCache, NpgsqlParameter)
    NpgsqlTypeHandler.ValidateAndGetLengthCustom<TAny>(TAny, NpgsqlLengthCache, NpgsqlParameter)
    NpgsqlTypeHandler.WriteWithLength<TAny>(TAny, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean, CancellationToken)
    NpgsqlTypeHandler.WriteWithLengthCustom<TAny>(TAny, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean, CancellationToken)
    NpgsqlTypeHandler.CreateConversionButNoParamException(Type)
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: Npgsql.Internal.TypeHandlers
    Assembly: Npgsql.dll
    Syntax
    public class RangeHandler<TSubtype1, TSubtype2> : RangeHandler<TSubtype1>, INpgsqlTypeHandler<NpgsqlRange<TSubtype1>>, INpgsqlTypeHandler<NpgsqlRange<TSubtype2>>
    Type Parameters
    Name Description
    TSubtype1

    The main range subtype.

    TSubtype2

    An alternative range subtype.

    Remarks

    Introduced in PostgreSQL 9.2. https://www.postgresql.org/docs/current/static/rangetypes.html

    Constructors

    RangeHandler(PostgresType, NpgsqlTypeHandler)

    Declaration
    public RangeHandler(PostgresType rangePostgresType, NpgsqlTypeHandler subtypeHandler)
    Parameters
    Type Name Description
    PostgresType rangePostgresType
    NpgsqlTypeHandler subtypeHandler

    Methods

    ValidateAndGetLength(NpgsqlRange<TSubtype2>, ref NpgsqlLengthCache, NpgsqlParameter)

    Responsible for validating that a value represents a value of the correct and which can be written for PostgreSQL - if the value cannot be written for any reason, an exception should be thrown. Also returns the byte length needed to write the value.

    Declaration
    public int ValidateAndGetLength(NpgsqlRange<TSubtype2> value, ref NpgsqlLengthCache lengthCache, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    NpgsqlRange<TSubtype2> value
    NpgsqlLengthCache lengthCache

    A cache where the length calculated during the validation phase can be stored for use at the writing phase.

    NpgsqlParameter parameter

    The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

    Returns
    Type Description
    Int32

    The number of bytes required to write the value.

    ValidateObjectAndGetLength(Object, ref NpgsqlLengthCache, NpgsqlParameter)

    Declaration
    public override int ValidateObjectAndGetLength(object value, ref NpgsqlLengthCache lengthCache, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    Object value
    NpgsqlLengthCache lengthCache
    NpgsqlParameter parameter
    Returns
    Type Description
    Int32
    Overrides
    NpgsqlTypeHandler.ValidateObjectAndGetLength(Object, ref NpgsqlLengthCache, NpgsqlParameter)

    Write(NpgsqlRange<TSubtype2>, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean, CancellationToken)

    Writes a value to the provided buffer.

    Declaration
    public Task Write(NpgsqlRange<TSubtype2> value, NpgsqlWriteBuffer buf, NpgsqlLengthCache lengthCache, NpgsqlParameter parameter, bool async, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    NpgsqlRange<TSubtype2> value
    NpgsqlWriteBuffer buf

    The buffer to which to write.

    NpgsqlLengthCache lengthCache

    A cache where the length calculated during the validation phase can be stored for use at the writing phase.

    NpgsqlParameter parameter

    The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

    Boolean async

    If I/O will be necessary (i.e. the buffer is full), determines whether it will be done synchronously or asynchronously.

    CancellationToken cancellationToken

    An optional token to cancel the asynchronous operation. The default value is None.

    Returns
    Type Description
    Task

    WriteObjectWithLength(Object, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean, CancellationToken)

    Declaration
    public override Task WriteObjectWithLength(object value, NpgsqlWriteBuffer buf, NpgsqlLengthCache lengthCache, NpgsqlParameter parameter, bool async, CancellationToken cancellationToken = default(CancellationToken))
    Parameters
    Type Name Description
    Object value
    NpgsqlWriteBuffer buf
    NpgsqlLengthCache lengthCache
    NpgsqlParameter parameter
    Boolean async
    CancellationToken cancellationToken
    Returns
    Type Description
    Task
    Overrides
    NpgsqlTypeHandler.WriteObjectWithLength(Object, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean, CancellationToken)

    Explicit Interface Implementations

    INpgsqlTypeHandler<NpgsqlRange<TSubtype2>>.Read(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)

    Declaration
    ValueTask<NpgsqlRange<TSubtype2>> INpgsqlTypeHandler<NpgsqlRange<TSubtype2>>.Read(NpgsqlReadBuffer buf, int len, bool async, FieldDescription fieldDescription)
    Parameters
    Type Name Description
    NpgsqlReadBuffer buf
    Int32 len
    Boolean async
    FieldDescription fieldDescription
    Returns
    Type Description
    ValueTask<NpgsqlRange<TSubtype2>>

    Implements

    INpgsqlTypeHandler<T>
    INpgsqlTypeHandler<T>
    In This Article
    Back to top © Copyright 2022 The Npgsql Development Team