Search Results for

    Show / Hide Table of Contents

    Class NpgsqlSimpleTypeHandlerWithPsv<TDefault, TPsv>

    A simple type handler that supports a provider-specific value in addition to its default value. This is necessary mainly in cases where the CLR type cannot represent the full range of the PostgreSQL type, and a custom CLR type is needed (e.g. DateTime and NpgsqlDateTime). The provider-specific type TPsv will be returned from calls to GetProviderSpecificValue(Int32).

    Inheritance
    Object
    NpgsqlTypeHandler
    NpgsqlTypeHandler<TDefault>
    NpgsqlSimpleTypeHandler<TDefault>
    NpgsqlSimpleTypeHandlerWithPsv<TDefault, TPsv>
    DateHandler
    IntervalHandler
    TimestampHandler
    TimestampTzHandler
    InetHandler
    Implements
    INpgsqlTypeHandler<TDefault>
    INpgsqlSimpleTypeHandler<TDefault>
    INpgsqlSimpleTypeHandler<TPsv>
    Inherited Members
    NpgsqlSimpleTypeHandler<TDefault>.Read(NpgsqlReadBuffer, Int32, FieldDescription)
    NpgsqlSimpleTypeHandler<TDefault>.Read(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
    NpgsqlSimpleTypeHandler<TDefault>.ValidateAndGetLength(TDefault, NpgsqlParameter)
    NpgsqlSimpleTypeHandler<TDefault>.Write(TDefault, NpgsqlWriteBuffer, NpgsqlParameter)
    NpgsqlSimpleTypeHandler<TDefault>.Write(TDefault, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean, CancellationToken)
    NpgsqlSimpleTypeHandler<TDefault>.ValidateAndGetLength(TDefault, NpgsqlLengthCache, NpgsqlParameter)
    NpgsqlTypeHandler<TDefault>.ReadAsObject(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
    NpgsqlTypeHandler<TDefault>.GetFieldType(FieldDescription)
    NpgsqlTypeHandler<TDefault>.CreateRangeHandler(PostgresType)
    NpgsqlTypeHandler<TDefault>.CreateMultirangeHandler(PostgresMultirangeType)
    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.ValidateObjectAndGetLength(Object, NpgsqlLengthCache, NpgsqlParameter)
    NpgsqlTypeHandler.WriteObjectWithLength(Object, 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.TypeHandling
    Assembly: Npgsql.dll
    Syntax
    public abstract class NpgsqlSimpleTypeHandlerWithPsv<TDefault, TPsv> : NpgsqlSimpleTypeHandler<TDefault>, INpgsqlTypeHandler<TDefault>, INpgsqlSimpleTypeHandler<TDefault>, INpgsqlSimpleTypeHandler<TPsv>
    Type Parameters
    Name Description
    TDefault

    The default CLR type that this handler will read and write. For example, calling GetValue(Int32) on a column with this handler will return a value with type TDefault. Type handlers can support additional types by implementing INpgsqlTypeHandler<T>.

    TPsv

    The provider-specific CLR type that this handler will read and write.

    Constructors

    NpgsqlSimpleTypeHandlerWithPsv(PostgresType)

    Declaration
    public NpgsqlSimpleTypeHandlerWithPsv(PostgresType pgType)
    Parameters
    Type Name Description
    PostgresType pgType

    Methods

    CreateArrayHandler(PostgresArrayType, ArrayNullabilityMode)

    Declaration
    public override NpgsqlTypeHandler CreateArrayHandler(PostgresArrayType pgArrayType, ArrayNullabilityMode arrayNullabilityMode)
    Parameters
    Type Name Description
    PostgresArrayType pgArrayType
    ArrayNullabilityMode arrayNullabilityMode
    Returns
    Type Description
    NpgsqlTypeHandler
    Overrides
    Npgsql.Internal.TypeHandling.NpgsqlTypeHandler<TDefault>.CreateArrayHandler(Npgsql.PostgresTypes.PostgresArrayType, Npgsql.ArrayNullabilityMode)

    GetProviderSpecificFieldType(FieldDescription)

    Declaration
    public override Type GetProviderSpecificFieldType(FieldDescription fieldDescription = null)
    Parameters
    Type Name Description
    FieldDescription fieldDescription
    Returns
    Type Description
    Type
    Overrides
    Npgsql.Internal.TypeHandling.NpgsqlTypeHandler<TDefault>.GetProviderSpecificFieldType(Npgsql.BackendMessages.FieldDescription)

    ReadPsv(NpgsqlReadBuffer, Int32, FieldDescription)

    Reads a value of type TPsv with the given length from the provided buffer, with the assumption that it is entirely present in the provided memory buffer and no I/O will be required.

    Declaration
    protected abstract TPsv ReadPsv(NpgsqlReadBuffer buf, int len, FieldDescription fieldDescription = null)
    Parameters
    Type Name Description
    NpgsqlReadBuffer buf

    The buffer from which to read.

    Int32 len

    The byte length of the value. The buffer might not contain the full length, requiring I/O to be performed.

    FieldDescription fieldDescription

    Additional PostgreSQL information about the type, such as the length in varchar(30).

    Returns
    Type Description
    TPsv

    The fully-read value.

    ValidateAndGetLength(TPsv, 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 shold be thrown. Also returns the byte length needed to write the value.

    Declaration
    public abstract int ValidateAndGetLength(TPsv value, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    TPsv value

    The value to be written to PostgreSQL

    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.

    Write(TPsv, NpgsqlWriteBuffer, NpgsqlParameter)

    Writes a value to the provided buffer, with the assumption that there is enough space in the buffer (no I/O will occur). The Npgsql core will have taken care of that.

    Declaration
    public abstract void Write(TPsv value, NpgsqlWriteBuffer buf, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    TPsv value

    The value to write.

    NpgsqlWriteBuffer buf

    The buffer to which to write.

    NpgsqlParameter parameter

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

    Explicit Interface Implementations

    INpgsqlSimpleTypeHandler<TPsv>.Read(NpgsqlReadBuffer, Int32, FieldDescription)

    Declaration
    TPsv INpgsqlSimpleTypeHandler<TPsv>.Read(NpgsqlReadBuffer buf, int len, FieldDescription fieldDescription)
    Parameters
    Type Name Description
    NpgsqlReadBuffer buf
    Int32 len
    FieldDescription fieldDescription
    Returns
    Type Description
    TPsv

    Implements

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