Class RangeHandler<TSubtype>
A type handler for PostgreSQL range types.
Inheritance
RangeHandler<TSubtype>
Assembly: Npgsql.dll
Syntax
public class RangeHandler<TSubtype> : NpgsqlTypeHandler, INpgsqlTypeHandler<NpgsqlRange<TSubtype>>
Type Parameters
Name |
Description |
TSubtype |
The range subtype.
|
Remarks
Constructors
RangeHandler(PostgresType, NpgsqlTypeHandler)
Declaration
public RangeHandler(PostgresType rangePostgresType, NpgsqlTypeHandler subtypeHandler)
Parameters
Properties
SubtypeHandler
The type handler for the subtype that this range type holds
Declaration
protected NpgsqlTypeHandler SubtypeHandler { get; }
Property Value
Methods
CreateArrayHandler(PostgresArrayType, ArrayNullabilityMode)
Creates a type handler for arrays of this handler's type.
Declaration
public override NpgsqlTypeHandler CreateArrayHandler(PostgresArrayType pgArrayType, ArrayNullabilityMode arrayNullabilityMode)
Parameters
Returns
Overrides
CreateMultirangeHandler(PostgresMultirangeType)
Creates a type handler for multiranges of this handler's type.
Declaration
public override NpgsqlTypeHandler CreateMultirangeHandler(PostgresMultirangeType pgMultirangeType)
Parameters
Returns
Overrides
CreateRangeHandler(PostgresType)
Creates a type handler for ranges of this handler's type.
Declaration
public override NpgsqlTypeHandler CreateRangeHandler(PostgresType pgRangeType)
Parameters
Returns
Overrides
GetFieldType(FieldDescription)
Declaration
public override Type GetFieldType(FieldDescription fieldDescription = null)
Parameters
Returns
Overrides
GetProviderSpecificFieldType(FieldDescription)
Declaration
public override Type GetProviderSpecificFieldType(FieldDescription fieldDescription = null)
Parameters
Returns
Overrides
Read(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
Reads a value of type T
with the given length from the provided buffer,
using either sync or async I/O.
Declaration
public ValueTask<NpgsqlRange<TSubtype>> Read(NpgsqlReadBuffer buf, int len, bool async, 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.
|
Boolean |
async |
If I/O is required to read the full length of the value, whether it should be performed synchronously or asynchronously.
|
FieldDescription |
fieldDescription |
Additional PostgreSQL information about the type, such as the length in varchar(30).
|
Returns
ReadAsObject(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
Declaration
public override async ValueTask<object> ReadAsObject(NpgsqlReadBuffer buf, int len, bool async, FieldDescription fieldDescription = null)
Parameters
Returns
Overrides
ReadRange<TAnySubtype>(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
Declaration
protected async ValueTask<NpgsqlRange<TAnySubtype>> ReadRange<TAnySubtype>(NpgsqlReadBuffer buf, int len, bool async, FieldDescription fieldDescription)
Parameters
Returns
Type Parameters
Name |
Description |
TAnySubtype |
|
ValidateAndGetLength(NpgsqlRange<TSubtype>, 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<TSubtype> value, ref NpgsqlLengthCache lengthCache, NpgsqlParameter parameter)
Parameters
Type |
Name |
Description |
NpgsqlRange<TSubtype> |
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.
|
ValidateAndGetLengthRange<TAnySubtype>(NpgsqlRange<TAnySubtype>, ref NpgsqlLengthCache, NpgsqlParameter)
Declaration
protected int ValidateAndGetLengthRange<TAnySubtype>(NpgsqlRange<TAnySubtype> value, ref NpgsqlLengthCache lengthCache, NpgsqlParameter parameter)
Parameters
Returns
Type Parameters
Name |
Description |
TAnySubtype |
|
Write(NpgsqlRange<TSubtype>, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean, CancellationToken)
Writes a value to the provided buffer.
Declaration
public Task Write(NpgsqlRange<TSubtype> value, NpgsqlWriteBuffer buf, NpgsqlLengthCache lengthCache, NpgsqlParameter parameter, bool async, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type |
Name |
Description |
NpgsqlRange<TSubtype> |
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
WriteRange<TAnySubtype>(NpgsqlRange<TAnySubtype>, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean, CancellationToken)
Declaration
protected async Task WriteRange<TAnySubtype>(NpgsqlRange<TAnySubtype> value, NpgsqlWriteBuffer buf, NpgsqlLengthCache lengthCache, NpgsqlParameter parameter, bool async, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
Type Parameters
Name |
Description |
TAnySubtype |
|
Implements