在我的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;
}
}