Using PostGIS from LinqPad
Hi, I'm trying to use PostGIS - and extension of Postgre which allows to work with geometries.
Before that I was working similar way with geopackage format which is actually almost similar thing but in SQLite format. I got byte[] as a result and manually converted them to NetTopolySuite geometries.
I use Linq2DB driver, when I connect I see following error:
Reading as 'System.Object' is not supported for fields having DataTypeName 'public.geometry'
Is there some know simple way to use such databases in LinqPad? Can I somehow receive bytes or map to geometry objects?
Answers
-
Found out that in my app code I have to do following:
var dataSourceBuilder = new NpgsqlDataSourceBuilder(connectionString); dataSourceBuilder.UseNetTopologySuite(); var dataSource = dataSourceBuilder.Build(); public sealed class MyConnection : DataConnection { public MyConnection(NpgsqlDataSource dataSource) : base(new DataOptions() .UseConnectionFactory( PostgreSQLTools.GetDataProvider(PostgreSQLVersion.v95), _ => dataSource.CreateConnection())) { } ... }But not sure if it is possible in LinqPad using native LinqPad connections infrastructure