Search Results for

    Show / Hide Table of Contents

    Class INpgsqlTypeMapperExtensions

    Extension methods over INpgsqlTypeMapper.

    Inheritance
    object
    INpgsqlTypeMapperExtensions
    Namespace: Npgsql
    Assembly: Npgsql.dll
    Syntax
    public static class INpgsqlTypeMapperExtensions

    Methods

    | Improve this Doc View Source

    EnableDynamicJsonMappings<T>(T, JsonSerializerOptions?, Type[]?, Type[]?)

    Sets up dynamic System.Text.Json mappings. This allows mapping arbitrary .NET types to PostgreSQL json and jsonb types, as well as and its derived types.

    Declaration
    public static T EnableDynamicJsonMappings<T>(this T mapper, JsonSerializerOptions? serializerOptions = null, Type[]? jsonbClrTypes = null, Type[]? jsonClrTypes = null) where T : INpgsqlTypeMapper
    Parameters
    Type Name Description
    T mapper

    The type mapper.

    JsonSerializerOptions? serializerOptions

    Options to customize JSON serialization and deserialization.

    Type[] jsonbClrTypes

    A list of CLR types to map to PostgreSQL jsonb (no need to specify Jsonb).

    Type[] jsonClrTypes

    A list of CLR types to map to PostgreSQL json (no need to specify Json).

    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    Remarks

    Due to the dynamic nature of these mappings, they are not compatible with NativeAOT or trimming.

    | Improve this Doc View Source

    EnableRecordsAsTuples<T>(T)

    Sets up mappings for the PostgreSQL record type as a .NET or .

    Declaration
    public static T EnableRecordsAsTuples<T>(this T mapper) where T : INpgsqlTypeMapper
    Parameters
    Type Name Description
    T mapper
    Returns
    Type Description
    T

    The same builder instance so that multiple calls can be chained.

    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    EnableUnmappedTypes<T>(T)

    Sets up mappings allowing the use of unmapped enum, range and multirange types.

    Declaration
    public static T EnableUnmappedTypes<T>(this T mapper) where T : INpgsqlTypeMapper
    Parameters
    Type Name Description
    T mapper
    Returns
    Type Description
    T

    The same builder instance so that multiple calls can be chained.

    Type Parameters
    Name Description
    T
    • Improve this Doc
    • View Source
    In This Article
    Back to top © Copyright 2023 The Npgsql Development Team