NHibernate Postgres 空间几何类型变为 NULL
NHibernate Postgres spatial geometry type become NULL
我在 C# 项目中使用 postgres/postgis 作为数据库,使用 Nhibernate 作为 ORM。
这是我第一次尝试将 postgis 映射到 .Net 应用程序。我的设置使用 NHibernate 版本 4.0.4.4000 和 NHibernate.Spatial.PostGis 4.0.4.4000(Npgsql 版本 3.0.5)
我按照 this tutorial 来设置映射,所以我有:
在web.config
<property name="dialect">NHibernate.Spatial.Dialect.PostGisDialect,NHibernate.Spatial.PostGis</property>
我添加的 nhibernate 配置
cfg.AddAuxiliaryDatabaseObject(new SpatialAuxiliaryDatabaseObject(cfg));
我的 xml 映射文件具有以下映射:
<property name="Geom" column="the_geom" type="NHibernate.Spatial.Type.GeometryType, NHibernate.Spatial" />
also tried using PostGis namespace in the mapping:
<property name="Geom" column="the_geom">
<type name="NHibernate.Spatial.Type.PostGisGeometryType, NHibernate.Spatial.PostGis">
<param name="srid">3006</param>
<param name="subtype">POLYGON</param>
</type>
</property>
我的模型 class 具有以下 属性
public virtual IGeometry Geom { get; set; }
现在,每当我获取任何几何图形时,属性 Geom 都是空的。
在日志中,我没有收到异常或错误消息。
我不知道还能尝试什么。
在这个 中,使用 MS sql 服务器,他成功运行了,因为他发现 hist 当前 dll (Microsoft.SqlServer.Types.dll) 和所需的支持不同版本的 Ms sql,因此将该 dll 映射到旧版本解决了该问题。会不会是这里的情况? how/what我可以试试吗?
我还查看了 通过定义他自己的 UserTypeConvention 对他有用的地方,但我没有定义 "UserTypeConvention",所以它对我不起作用。
我试过在 gis stackexchange 上发布这个问题但没有结果,所以我在这里尝试。
我在 C# 项目中使用 postgres/postgis 作为数据库,使用 Nhibernate 作为 ORM。
这是我第一次尝试将 postgis 映射到 .Net 应用程序。我的设置使用 NHibernate 版本 4.0.4.4000 和 NHibernate.Spatial.PostGis 4.0.4.4000(Npgsql 版本 3.0.5)
我按照 this tutorial 来设置映射,所以我有:
在web.config
<property name="dialect">NHibernate.Spatial.Dialect.PostGisDialect,NHibernate.Spatial.PostGis</property>
我添加的 nhibernate 配置
cfg.AddAuxiliaryDatabaseObject(new SpatialAuxiliaryDatabaseObject(cfg));
我的 xml 映射文件具有以下映射:
<property name="Geom" column="the_geom" type="NHibernate.Spatial.Type.GeometryType, NHibernate.Spatial" />
also tried using PostGis namespace in the mapping:
<property name="Geom" column="the_geom">
<type name="NHibernate.Spatial.Type.PostGisGeometryType, NHibernate.Spatial.PostGis">
<param name="srid">3006</param>
<param name="subtype">POLYGON</param>
</type>
</property>
我的模型 class 具有以下 属性
public virtual IGeometry Geom { get; set; }
现在,每当我获取任何几何图形时,属性 Geom 都是空的。 在日志中,我没有收到异常或错误消息。 我不知道还能尝试什么。
在这个
我还查看了
我试过在 gis stackexchange 上发布这个问题但没有结果,所以我在这里尝试。