Search Results for

    Show / Hide Table of Contents

    Class InetHandler

    A type handler for the PostgreSQL cidr data type.

    Inheritance
    Object
    NpgsqlTypeHandler
    NpgsqlTypeHandler<IPAddress>
    NpgsqlSimpleTypeHandler<IPAddress>
    NpgsqlSimpleTypeHandlerWithPsv<IPAddress, (T1, T2)<IPAddress, Int32>>
    InetHandler
    Implements
    INpgsqlTypeHandler<IPAddress>
    INpgsqlSimpleTypeHandler<IPAddress>
    INpgsqlSimpleTypeHandler<(T1, T2)<IPAddress, Int32>>
    INpgsqlSimpleTypeHandler<NpgsqlInet>
    Inherited Members
    NpgsqlSimpleTypeHandlerWithPsv<IPAddress, (IPAddress Address, Int32 Subnet)>.ReadPsv(NpgsqlReadBuffer, Int32, FieldDescription)
    NpgsqlSimpleTypeHandlerWithPsv<IPAddress, (IPAddress Address, Int32 Subnet)>.INpgsqlSimpleTypeHandler<(IPAddress Address, Int32 Subnet)>.Read(NpgsqlReadBuffer, Int32, FieldDescription)
    NpgsqlSimpleTypeHandlerWithPsv<IPAddress, (IPAddress Address, Int32 Subnet)>.ValidateAndGetLength((T1, T2)<IPAddress, Int32>, NpgsqlParameter)
    NpgsqlSimpleTypeHandlerWithPsv<IPAddress, (IPAddress Address, Int32 Subnet)>.Write((T1, T2)<IPAddress, Int32>, NpgsqlWriteBuffer, NpgsqlParameter)
    NpgsqlSimpleTypeHandlerWithPsv<IPAddress, (IPAddress Address, Int32 Subnet)>.CreateArrayHandler(PostgresArrayType)
    NpgsqlSimpleTypeHandler<IPAddress>.Read(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
    NpgsqlSimpleTypeHandler<IPAddress>.Read<TAny>(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
    NpgsqlSimpleTypeHandler<IPAddress>.Read<TAny>(NpgsqlReadBuffer, Int32, FieldDescription)
    NpgsqlSimpleTypeHandler<IPAddress>.ValidateAndGetLength<TAny>(TAny, NpgsqlLengthCache, NpgsqlParameter)
    NpgsqlSimpleTypeHandler<IPAddress>.Write(IPAddress, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean)
    NpgsqlSimpleTypeHandler<IPAddress>.ValidateAndGetLength(IPAddress, NpgsqlLengthCache, NpgsqlParameter)
    NpgsqlTypeHandler<IPAddress>.WriteWithLength<TAny>(TAny, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean)
    NpgsqlTypeHandler<IPAddress>.CreateArrayHandler(PostgresArrayType)
    NpgsqlTypeHandler<IPAddress>.CreateRangeHandler(PostgresRangeType)
    NpgsqlTypeHandler.CreateConversionButNoParamException(Type)
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: Npgsql.TypeHandlers.NetworkHandlers
    Assembly: Npgsql.dll
    Syntax
    public class InetHandler : NpgsqlSimpleTypeHandlerWithPsv<IPAddress, (IPAddress Address, int Subnet)>, INpgsqlTypeHandler<IPAddress>, INpgsqlSimpleTypeHandler<IPAddress>, INpgsqlSimpleTypeHandler<(IPAddress Address, int Subnet)>, INpgsqlSimpleTypeHandler<NpgsqlInet>
    Remarks

    See http://www.postgresql.org/docs/current/static/datatype-net-types.html.

    The type handler API allows customizing Npgsql's behavior in powerful ways. However, although it is public, it should be considered somewhat unstable, and may change in breaking ways, including in non-major releases. Use it at your own risk.

    Constructors

    | Improve this Doc

    InetHandler(PostgresType)

    Declaration
    public InetHandler(PostgresType postgresType)
    Parameters
    Type Name Description
    PostgresType postgresType

    Methods

    | Improve this Doc

    Read(NpgsqlReadBuffer, Int32, FieldDescription)

    Reads a value of type TDefault 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
    public override IPAddress Read(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
    IPAddress

    The fully-read value.

    Overrides
    Npgsql.TypeHandling.NpgsqlSimpleTypeHandler<System.Net.IPAddress>.Read(Npgsql.NpgsqlReadBuffer, System.Int32, Npgsql.BackendMessages.FieldDescription)
    | Improve this Doc

    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 override (IPAddress Address, int Subnet) 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
    (T1, T2)<IPAddress, Int32>

    The fully-read value.

    Overrides
    Npgsql.TypeHandling.NpgsqlSimpleTypeHandlerWithPsv<System.Net.IPAddress, System.ValueTuple<System.Net.IPAddress, System.Int32>>.ReadPsv(Npgsql.NpgsqlReadBuffer, System.Int32, Npgsql.BackendMessages.FieldDescription)
    | Improve this Doc

    ValidateAndGetLength(NpgsqlInet, 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 int ValidateAndGetLength(NpgsqlInet value, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    NpgsqlInet value
    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.

    | Improve this Doc

    ValidateAndGetLength(IPAddress, 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 override int ValidateAndGetLength(IPAddress value, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    IPAddress value
    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.

    Overrides
    Npgsql.TypeHandling.NpgsqlSimpleTypeHandler<System.Net.IPAddress>.ValidateAndGetLength(System.Net.IPAddress, Npgsql.NpgsqlParameter)
    | Improve this Doc

    ValidateAndGetLength((IPAddress Address, Int32 Subnet), 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 override int ValidateAndGetLength((IPAddress Address, int Subnet) value, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    (T1, T2)<IPAddress, Int32> value
    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.

    Overrides
    Npgsql.TypeHandling.NpgsqlSimpleTypeHandlerWithPsv<System.Net.IPAddress, System.ValueTuple<System.Net.IPAddress, System.Int32>>.ValidateAndGetLength(System.ValueTuple<System.Net.IPAddress, System.Int32>, Npgsql.NpgsqlParameter)
    | Improve this Doc

    ValidateObjectAndGetLength(Object, ref NpgsqlLengthCache, NpgsqlParameter)

    Called to validate and get the length of a value of a non-generic NpgsqlParameter. Type handlers generally don't need to override this.

    Declaration
    protected 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
    Npgsql.TypeHandling.NpgsqlSimpleTypeHandler<System.Net.IPAddress>.ValidateObjectAndGetLength(System.Object, Npgsql.NpgsqlLengthCache, Npgsql.NpgsqlParameter)
    | Improve this Doc

    Write(NpgsqlInet, 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 void Write(NpgsqlInet value, NpgsqlWriteBuffer buf, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    NpgsqlInet value
    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).

    | Improve this Doc

    Write(IPAddress, 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 override void Write(IPAddress value, NpgsqlWriteBuffer buf, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    IPAddress value
    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).

    Overrides
    Npgsql.TypeHandling.NpgsqlSimpleTypeHandler<System.Net.IPAddress>.Write(System.Net.IPAddress, Npgsql.NpgsqlWriteBuffer, Npgsql.NpgsqlParameter)
    | Improve this Doc

    Write((IPAddress Address, Int32 Subnet), 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 override void Write((IPAddress Address, int Subnet) value, NpgsqlWriteBuffer buf, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    (T1, T2)<IPAddress, Int32> value
    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).

    Overrides
    Npgsql.TypeHandling.NpgsqlSimpleTypeHandlerWithPsv<System.Net.IPAddress, System.ValueTuple<System.Net.IPAddress, System.Int32>>.Write(System.ValueTuple<System.Net.IPAddress, System.Int32>, Npgsql.NpgsqlWriteBuffer, Npgsql.NpgsqlParameter)
    | Improve this Doc

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

    Called to write the value of a non-generic NpgsqlParameter. Type handlers generally don't need to override this.

    Declaration
    protected override Task WriteObjectWithLength(object value, NpgsqlWriteBuffer buf, NpgsqlLengthCache lengthCache, NpgsqlParameter parameter, bool async)
    Parameters
    Type Name Description
    Object value
    NpgsqlWriteBuffer buf
    NpgsqlLengthCache lengthCache
    NpgsqlParameter parameter
    Boolean async
    Returns
    Type Description
    Task
    Overrides
    Npgsql.TypeHandling.NpgsqlSimpleTypeHandler<System.Net.IPAddress>.WriteObjectWithLength(System.Object, Npgsql.NpgsqlWriteBuffer, Npgsql.NpgsqlLengthCache, Npgsql.NpgsqlParameter, System.Boolean)

    Explicit Interface Implementations

    | Improve this Doc

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

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

    Implements

    INpgsqlTypeHandler<T>
    INpgsqlSimpleTypeHandler<T>
    INpgsqlSimpleTypeHandler<T>
    INpgsqlSimpleTypeHandler<T>
    • Improve this Doc
    In This Article
    Back to top © Copyright 2021 The Npgsql Development Team