Show / Hide Table of Contents

Interface INpgsqlSimpleTypeHandler<T>

Type handlers that wish to support reading other types in additional to the main one can implement this interface for all those types.

Namespace: Npgsql.TypeHandling
Assembly: Npgsql.dll
Syntax
public interface INpgsqlSimpleTypeHandler<T>
Type Parameters
Name Description
T

Methods

Read(NpgsqlReadBuffer, Int32, FieldDescription)

Reads a value of type T 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
T Read(NpgsqlReadBuffer buf, int len, FieldDescription fieldDescription = null)
Parameters
Type Name Description
NpgsqlReadBuffer buf

The buffer from which to read.

System.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
T

The fully-read value.

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

The number of bytes required to write the value.

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

Back to top Generated by DocFX