コード例 #1
0
 private void AssertIsDynamicQuery(DynamicSpatialField dynamicField, string methodName)
 {
     if (FromToken.IsDynamic == false)
     {
         throw new InvalidOperationException($"Cannot execute query method '{methodName}'. Field '{dynamicField.ToField(EnsureValidFieldName)}' cannot be used when static index '{FromToken.IndexName}' is queried. Dynamic spatial fields can only be used with dynamic queries, for static index queries please use valid spatial fields defined in index definition.");
     }
 }
コード例 #2
0
        /// <inheritdoc />
        public void OrderByDistance(DynamicSpatialField field, double latitude, double longitude)
        {
            if (field == null)
            {
                throw new ArgumentNullException(nameof(field));
            }

            OrderByDistance($"'{field.ToField(EnsureValidFieldName)}'", latitude, longitude);
        }
コード例 #3
0
        /// <inheritdoc />
        public void Spatial(DynamicSpatialField dynamicField, SpatialCriteria criteria)
        {
            var tokens = GetCurrentWhereTokens();

            AppendOperatorIfNeeded(tokens);
            NegateIfNeeded(tokens, null);

            tokens.AddLast(criteria.ToQueryToken(dynamicField.ToField(EnsureValidFieldName), AddQueryParameter));
        }
コード例 #4
0
        /// <inheritdoc />
        public void OrderByDistanceDescending(DynamicSpatialField field, string shapeWkt)
        {
            if (field == null)
            {
                throw new ArgumentNullException(nameof(field));
            }

            OrderByDistanceDescending($"'{field.ToField(EnsureValidFieldName)}'", shapeWkt);
        }
コード例 #5
0
        /// <inheritdoc />
        public void OrderByDistanceDescending(DynamicSpatialField field, double latitude, double longitude)
        {
            if (field == null)
            {
                throw new ArgumentNullException(nameof(field));
            }

            AssertIsDynamicQuery(field, nameof(OrderByDistanceDescending));

            OrderByDistanceDescending($"'{field.ToField(EnsureValidFieldName)}'", latitude, longitude);
        }
コード例 #6
0
        /// <inheritdoc />
        public void OrderByDistance(DynamicSpatialField field, string shapeWkt)
        {
            if (field == null)
            {
                throw new ArgumentNullException(nameof(field));
            }

            AssertIsDynamicQuery(field, nameof(OrderByDistance));

            OrderByDistance($"'{field.ToField(EnsureValidFieldName)}'", shapeWkt);
        }
コード例 #7
0
 /// <inheritdoc />
 IDocumentQuery <T> IDocumentQueryBase <T, IDocumentQuery <T> > .OrderByDistance(DynamicSpatialField field, string shapeWkt)
 {
     OrderByDistance(field, shapeWkt);
     return(this);
 }
コード例 #8
0
 /// <inheritdoc />
 IDocumentQuery <T> IDocumentQueryBase <T, IDocumentQuery <T> > .OrderByDistance(DynamicSpatialField field, double latitude, double longitude)
 {
     OrderByDistance(field, latitude, longitude);
     return(this);
 }
コード例 #9
0
        /// <inheritdoc />
        IDocumentQuery <T> IFilterDocumentQueryBase <T, IDocumentQuery <T> > .Spatial(DynamicSpatialField field, Func <SpatialCriteriaFactory, SpatialCriteria> clause)
        {
            var criteria = clause(SpatialCriteriaFactory.Instance);

            Spatial(field, criteria);
            return(this);
        }