Class INpgsqlTypeMapperExtensions
Extension methods over INpgsqlTypeMapper.
Namespace: Npgsql
Assembly: Npgsql.dll
Syntax
public static class INpgsqlTypeMapperExtensions
Methods
| Improve this Doc View SourceEnableDynamicJsonMappings<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
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 |
Type[] | jsonClrTypes | A list of CLR types to map to PostgreSQL |
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.
EnableRecordsAsTuples<T>(T)
Sets up mappings for the PostgreSQL record
type as a .NET
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 |
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 |