/// <summary> /// Sets up JSON.NET mappings for the PostgreSQL json and jsonb types. /// </summary> /// <param name="mapper">The type mapper to set up (global or connection-specific)</param> /// <param name="jsonbClrTypes">A list of CLR types to map to PostgreSQL jsonb (no need to specify NpgsqlDbType.Jsonb)</param> /// <param name="jsonClrTypes">A list of CLR types to map to PostgreSQL json (no need to specify NpgsqlDbType.Json)</param> /// <param name="settings">Optional settings to customize JSON serialization</param> public static INpgsqlTypeMapper UseJsonNet( this INpgsqlTypeMapper mapper, Type[]?jsonbClrTypes = null, Type[]?jsonClrTypes = null, JsonSerializerSettings?settings = null) { mapper.AddTypeResolverFactory(new JsonNetTypeHandlerResolverFactory(jsonbClrTypes, jsonClrTypes, settings)); return(mapper); }
/// <summary> /// Sets up NetTopologySuite mappings for the PostGIS types. /// </summary> /// <param name="mapper">The type mapper to set up (global or connection-specific).</param> /// <param name="coordinateSequenceFactory">The factory which knows how to build a particular implementation of ICoordinateSequence from an array of Coordinates.</param> /// <param name="precisionModel">Specifies the grid of allowable points.</param> /// <param name="handleOrdinates">Specifies the ordinates which will be handled. Not specified ordinates will be ignored. /// If <see cref="F:GeoAPI.Geometries.Ordiantes.None" /> is specified, an actual value will be taken from /// the <see cref="P:GeoAPI.Geometries.ICoordinateSequenceFactory.Ordinates"/> property of <paramref name="coordinateSequenceFactory"/>.</param> /// <param name="geographyAsDefault">Specifies that the geography type is used for mapping by default.</param> public static INpgsqlTypeMapper UseNetTopologySuite( this INpgsqlTypeMapper mapper, CoordinateSequenceFactory?coordinateSequenceFactory = null, PrecisionModel?precisionModel = null, Ordinates handleOrdinates = Ordinates.None, bool geographyAsDefault = false) { mapper.AddTypeResolverFactory( new NetTopologySuiteTypeHandlerResolverFactory( coordinateSequenceFactory, precisionModel, handleOrdinates, geographyAsDefault)); return(mapper); }
/// <summary> /// Sets up NodaTime mappings for the PostgreSQL date/time types. /// </summary> /// <param name="mapper">The type mapper to set up (global or connection-specific)</param> public static INpgsqlTypeMapper UseNodaTime(this INpgsqlTypeMapper mapper) { mapper.AddTypeResolverFactory(new NodaTimeTypeHandlerResolverFactory()); return(mapper); }
/// <summary> /// Sets up GeoJSON mappings for the PostGIS types. /// </summary> /// <param name="mapper">The type mapper to set up (global or connection-specific)</param> /// <param name="options">Options to use when constructing objects.</param> /// <param name="geographyAsDefault">Specifies that the geography type is used for mapping by default.</param> public static INpgsqlTypeMapper UseGeoJson(this INpgsqlTypeMapper mapper, GeoJSONOptions options = GeoJSONOptions.None, bool geographyAsDefault = false) { mapper.AddTypeResolverFactory(new GeoJSONTypeHandlerResolverFactory(options, geographyAsDefault)); return(mapper); }