Quelqu'un a-t-il mis en œuvre ceci, ou sait-il s'il serait difficile de l'implémenter / a des pointeurs?
public static SpatialRelationCriterion IsWithinDistance(string propertyName, object anotherGeometry, double distance)
{
    // TODO: Implement
    throw new NotImplementedException();
}
depuis NHibernate.Spatial.Criterion.SpatialRestrictions
Je peux utiliser "où NHSP.Distance (PROPRIÉTÉ,: point)" dans hql. Mais je veux combiner cette requête avec ma requête Critères existante.
pour le moment, je crée un polygone grossier et j'utilise
criteria.Add(SpatialRestrictions.Intersects("PROPERTY", myPolygon));
EDIT Un prototype fonctionne en surchargeant le constructeur sur SpatialRelationCriterion, en ajoutant un nouveau SpatialRelation.Distance
public static SpatialRelationCriterion IsWithinDistance(string propertyName, object anotherGeometry, double distance)
        {
            return new SpatialRelationCriterion(propertyName, SpatialRelation.Distance, anotherGeometry, distance);
        }
a ajouté un nouveau champ à SpatialRelationCriterion
private readonly double? distance;
public SpatialRelationCriterion(string propertyName, SpatialRelation relation, object anotherGeometry, double distance)
            : this(propertyName, relation, anotherGeometry)
        {
            this.distance = distance;
        }
ToSqlString modifié
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));
                }
surcharge ISpatialDialect.GetSpatialRelationString
surcharge implémentée dans MsSql2008SpatialDialect
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();
        }
Vous ne savez pas pourquoi AddParameter n'est pas utilisé?