이것을 구현 한 사람이 있습니까? 아니면이 포인터를 구현하기가 어렵거나 포인터가 있습니까? HQL에서 :Criteria SpatialRestrictions.IsWithinDistance NHibernate.Spatial
public static SpatialRelationCriterion IsWithinDistance(string propertyName, object anotherGeometry, double distance)
{
// TODO: Implement
throw new NotImplementedException();
}
NHibernate.Spatial.Criterion.SpatialRestrictions
에서 나는 "여기서 NHSP.Distance (포인트 재산,)"를 사용할 수 있습니다. 그러나이 쿼리를 기존의 Criteria 쿼리와 결합하고 싶습니다. 순간 나는 거친 다각형을 생성하고 이 SpatialRelationCriterion에 생성자를 오버로드로 작동하는 프로토 타입을 얻었다
criteria.Add(SpatialRestrictions.Intersects("PROPERTY", myPolygon));
편집을 사용하고 있습니다위한
, 새로운 SpatialRelation.Distance를 추가public static SpatialRelationCriterion IsWithinDistance(string propertyName, object anotherGeometry, double distance)
{
return new SpatialRelationCriterion(propertyName, SpatialRelation.Distance, anotherGeometry, distance);
}
는 SpatialRelationCriterion에 새로운 필드를 추가했습니다.
private readonly double? distance;
public SpatialRelationCriterion(string propertyName, SpatialRelation relation, object anotherGeometry, double distance)
: this(propertyName, relation, anotherGeometry)
{
this.distance = distance;
}
편집 ToSqlString
public SqlString GetSpatialRelationString(object geometry, SpatialRelation relation, object anotherGeometry, double distance, bool criterion)
{
var x = new SqlStringBuilder(8)
.AddObject(geometry)
.Add(".ST")
.Add(relation.ToString())
.Add("(")
.AddObject(anotherGeometry)
.Add(")");
if (criterion)
{
x.Add(" < ");
x.AddObject(distance.ToString());
}
return x.ToSqlString();
}
확실하지 MsSql2008SpatialDialect
에 ISpatialDialect.GetSpatialRelationString구현 과부하 과부하
object secondGeometry = Parameter.Placeholder;
if (!(this.anotherGeometry is IGeometry))
{
secondGeometry = columns2[i];
}
if (distance.HasValue)
{
builder.Add(spatialDialect.GetSpatialRelationString(columns1[i], this.relation, secondGeometry, distance.Value, true));
}
else
{
builder.Add(spatialDialect.GetSpatialRelationString(columns1[i], this.relation, secondGeometry, true));
}
왜 AddParameter 사용하지?
나는 동일한 문제가 있으며, 지금까지는 완전한 패치/수정본을 찾지 못했습니다. 그것을 해결 했습니까, 아니면 HQL 변형과 함께 갔습니까? – Liedman
Think은 위의 접근 방식을 취하고 dll을 다시 컴파일하여 작동하지만 여전히 실험 코드였습니다. – Ian
@Amresh OP가주는 제안 된 솔루션에 만족하지 않습니까? – Eranga