public override void ModifyQueryDescription(QueryDescriptionBuilder queryDescription, Type resultType)
        {
            var relationTypeExpr = FirstParameter as ConstantExpression;
            var parentIdsExpr = ExcludeParentIds as ConstantExpression;

            if (relationTypeExpr == null || parentIdsExpr == null)
                return;

            var relationType = (relationTypeExpr.Value as RelationType) ?? FixedRelationTypes.DefaultRelationType;
            var parentIds = (parentIdsExpr.Value as IEnumerable<HiveId>) ?? Enumerable.Empty<HiveId>();

            if (parentIds.Any())
            {
                queryDescription.From.ExcludeParentIds = parentIds;
            }
        }
 public override void ModifyQueryDescription(QueryDescriptionBuilder queryDescription, Type resultType)
 {
     var constant = FirstParameter as ConstantExpression;
     queryDescription.From.RevisionStatusType = (RevisionStatusType)(constant.Value);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Visits the <paramref name="queryModel"/> and generates a <see cref="QueryDescription"/>.
        /// </summary>
        /// <param name="queryModel">The query model.</param>
        /// <returns></returns>
        /// <remarks></remarks>
        public QueryDescription VisitAndGenerateQueryDescription(Remotion.Linq.QueryModel queryModel)
        {
            // Reset description builder
            _queryDescription = new QueryDescriptionBuilder();

            VisitQueryModel(queryModel);

            // If we haven't found any result operators then add one just saying sequence
            if (!_queryDescription.ResultFilters.Any())
                _queryDescription.AddResultFilter(GetResultType(queryModel), ResultFilterType.Sequence, -1);

            return _queryDescription;
        }
 public override void ModifyQueryDescription(QueryDescriptionBuilder queryDescription, Type resultType)
 {
     var constant = FirstParameter as ConstantExpression;
     //queryDescription.From.RequiredEntityIds = (IEnumerable<HiveId>)(constant.Value);
 }
Exemplo n.º 5
0
        /// <summary>
        /// Visits the <paramref name="queryModel"/> and generates a <see cref="QueryDescription"/>.
        /// </summary>
        /// <param name="queryModel">The query model.</param>
        /// <returns></returns>
        /// <remarks></remarks>
        public QueryDescription VisitAndGenerateQueryDescription(Remotion.Linq.QueryModel queryModel)
        {
            // Reset description builder
            _queryDescription = new QueryDescriptionBuilder();

            VisitQueryModel(queryModel);

            return _queryDescription;
        }
        public override void ModifyQueryDescription(QueryDescriptionBuilder queryDescription, Type resultType)
        {
            var pageNumberExpr = FirstParameter as ConstantExpression;
            var pageSizeExpr = PageSize as ConstantExpression;

            if (pageNumberExpr == null || pageSizeExpr == null)
                return;

            int? pageNumber = pageNumberExpr.Value as int?;
            int? pageSize = pageSizeExpr.Value as int?;

            if (pageNumber.HasValue && pageSize.HasValue)
            {
                queryDescription.AddSkipResultFilter(resultType, pageSize.Value * (pageNumber.Value - 1));
                queryDescription.AddTakeResultFilter(resultType, pageSize.Value);
            }
        }