示例#1
0
        protected SPModelQuery ApplyFilters()
        {
            CamlExpression expression = originalExpression;

            if (expression == Caml.False || expressionForCTFilter == Caml.False)
            {
                return(this);
            }
            foreach (ISPModelQueryFilter filter in filters)
            {
                if (filter.ShouldTransformExpression(this))
                {
                    ISPModelQueryFilter clone = (ISPModelQueryFilter)filter.Clone();
                    expression = clone.TransformExpression(this, expression);
                    if (expression == Caml.False)
                    {
                        break;
                    }
                }
            }
            if (expression != this.Expression)
            {
                SPModelQuery result = (SPModelQuery)MemberwiseClone();
                result.originalExpression = expression;
                result.expression         = null;
                return(result);
            }
            return(this);
        }
示例#2
0
 public virtual bool ShouldTransformExpression(SPModelQuery query)
 {
     return(true);
 }
示例#3
0
 CamlExpression ISPModelQueryFilter.TransformExpression(SPModelQuery query, CamlExpression expression)
 {
     Initialize(query);
     return(base.Visit(expression));
 }
示例#4
0
 protected virtual void Initialize(SPModelQuery query)
 {
 }
示例#5
0
        protected override void Initialize(SPModelQuery query)
        {
            SPList list = query.Manager.ContextLists.First().EnsureList(query.Manager.ObjectCache).List;

            this.allowedFields = list.Fields.OfType <SPField>().Select(v => v.InternalName).ToArray();
        }
示例#6
0
 public override bool ShouldTransformExpression(SPModelQuery query)
 {
     return(!query.ForceKeywordSearch && query.Manager.ImplicitQueryMode == SPModelImplicitQueryMode.ListQuery);
 }