forked from npgsql/npgsql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNpgsqlRawPostgisExtensions.cs
More file actions
26 lines (25 loc) · 912 Bytes
/
NpgsqlRawPostgisExtensions.cs
File metadata and controls
26 lines (25 loc) · 912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using Npgsql.RawPostgis;
using Npgsql.TypeMapping;
using NpgsqlTypes;
// ReSharper disable once CheckNamespace
namespace Npgsql
{
/// <summary>
/// Extension adding the legacy PostGIS types to an Npgsql type mapper.
/// </summary>
public static class NpgsqlRawPostgisExtensions
{
/// <summary>
/// Sets up the legacy PostGIS types to an Npgsql type mapper.
/// </summary>
/// <param name="mapper">The type mapper to set up (global or connection-specific)</param>
public static INpgsqlTypeMapper UseRawPostgis(this INpgsqlTypeMapper mapper)
=> mapper
.AddMapping(new NpgsqlTypeMappingBuilder
{
PgTypeName = "geometry",
NpgsqlDbType = NpgsqlDbType.Geometry,
TypeHandlerFactory = new PostgisRawHandlerFactory()
}.Build());
}
}