Search code examples
postgresqlentity-framework-6npgsql

Npgsql Entity Framework database first not generating point type properties


I'm attempting to generate an EDMX model with Npgsql 3.2.7, EntityFramework6.Npsgql 3.1.1 and Entity Framework 6.2 database first.

The model is generating fine except for any columns that are of the type point. For some strange reason, the properties for those columns are not being added to the entity models, everything else is added fine though.

I get the following error once model generation is done:

Error 6005: The data type 'point' is currently not supported for the target Entity Framework version; the column 'LatLong' in the table 'test.public.Nodes' was excluded.

From the documentation it seems as if the point type column is supposed to map to the NpgsqlPoint type. This doesnt seem to be happening in my case. Is there anyway to get this to work?


Solution

  • Entity Framework 6.x supports only a limited, closed set of types, which doesn't include PostgreSQL's point type. The documentation you're linking to is for Npgsql, the ADO.NET provider, which is the layer below the Entity Framework provider.

    Entity Framework Core does have extensible type mapping and supports point out of the box, I suggest you give it a try if possible.