流利的nHibernate无法检索地理列类型的不同值

时间:2015-05-19 14:28:40

标签: c# fluent-nhibernate

在我的SQL Server表中,我有地理列类型。我尝试检索不同的坐标列表,这里是片段:

MyTable tableQueryAlias = null;

var query = Session.QueryOver<MyTable>(() => tableQueryAlias)

var distinct = Projections.Distinct(
                              Projections.ProjectionList()
                                         .Add(Projections.Property(() => tableQueryAlias.GEO.Coordinate.X))
                                         .Add(Projections.Property(() => tableQueryAlias.GEO.Coordinate.Y)));

query = query.Select(projections);

但我收到could not resolve property: GEO.Coordinate.X of: MyTable错误。如何解决?

GEO列是.cs文件中的Point类型(来自NetTopologySuite.dll库)

编辑:

映射类(片段)

Map(a => a.GEO).CustomType<Wgs84GeographyType>();

Wgs84GeographyType班级:

    [Serializable]
    public class Wgs84GeographyType : NHibernate.Spatial.Type.MsSql2008GeographyType
    {
        protected override void SetDefaultSRID(GeoAPI.Geometries.IGeometry geometry)
        {
            geometry.SRID = 4326;
        }
    }

0 个答案:

没有答案