使用实体框架edmx文件

时间:2019-12-29 15:13:12

标签: entity-framework-6 postgis npgsql

我正在编码C#应用程序基础结构,以尝试将EntityFramework 6与PostGIS DB一起使用。 我将VS 2015 Update 3与Npgsql 4.0.1.0一起使用。 我已经安装了相同版本的Npgsql.vsix。 我尝试使用数据库优先方法,但是edmx文件内部出现以下错误:

warning 6005: The data type 'geography' is currently not supported for the target Entity Framework version; the column 'geog' in the table 'postgis_24_sample.public.district_municipalities_2016' was excluded.

并且我创建的实体没有“ geography”类型的属性。 因此,我已经使用edmx编辑向导将“地理”属性手动添加到了我的实体中。 我尝试了System.Data.Entity.Spatial.DbGeography类型。它已添加到edmx文件的edmx:ConceptualModels部分,但是我无法将其映射到DB列。 当我尝试“从模型生成数据库...”时,出现以下错误

不支持的edm类型:Edm.Geography

我尝试将类型更改为NetTopologySuite.Geometries.Geometry 即使在edmx:ConceptualModels部分中,我也无法映射它

我该怎么做才能获得GIS类型映射的支持?

0 个答案:

没有答案