Пример #1
0
        internal DirectorySearcherExpression(Type type, DirectoryEntry searchRoot, IEnumerable <LdapAttributeExpression> attributesToLoad, Expression filter, SearchScope scope, LdapSortExpression sort, Expression skip, Expression take)
        {
            this._type       = type;
            this._scope      = scope;
            this._searchRoot = searchRoot;
            var props = attributesToLoad as ReadOnlyCollection <LdapAttributeExpression>;

            if (props == null)
            {
                props = new List <LdapAttributeExpression>(attributesToLoad).AsReadOnly();
            }
            this._attributesToLoad = props;
            this._filter           = filter;
            this._sort             = sort;
            this._skip             = skip;
            this._take             = take;
        }
Пример #2
0
        private ProjectionExpression BindOrderBy(Type type, Expression source, LambdaExpression orderSelector, SortDirection direction)
        {
            ProjectionExpression sourceProjection = this.VisitSequence(source);

            if (sourceProjection.Searcher.Sort != null)
            {
                throw new NotSupportedException("Cannot order by more than one attribute.");
            }
            this._projectionMap[orderSelector.Parameters[0]] = sourceProjection.Projector;
            var sort = new LdapSortExpression(this.Visit(orderSelector.Body), direction);

            return(sourceProjection.Update(
                       sourceProjection.Searcher.Update(
                           sourceProjection.Searcher.Filter,
                           sourceProjection.Searcher.AttributesToLoad,
                           sort
                           )
                       ));
        }
Пример #3
0
 public DirectorySearcherExpression Update(Expression filter, IEnumerable <LdapAttributeExpression> attributesToLoad, LdapSortExpression sort, Expression skip, Expression take)
 {
     if (
         filter == this.Filter &&
         attributesToLoad == this.AttributesToLoad &&
         sort == this.Sort &&
         skip == this.Skip &&
         take == this.Take
         )
     {
         return(this);
     }
     else
     {
         return(new DirectorySearcherExpression(
                    this.Type,
                    this.SearchRoot,
                    attributesToLoad,
                    filter,
                    this.Scope,
                    sort,
                    skip,
                    take
                    ));
     }
 }
Пример #4
0
 public DirectorySearcherExpression Update(Expression filter, IEnumerable <LdapAttributeExpression> attributesToLoad, LdapSortExpression sort)
 {
     return(this.Update(filter, attributesToLoad, sort, this.Skip, this.Take));
 }
Пример #5
0
 protected virtual Expression VisitSort(LdapSortExpression node)
 {
     return(node.Update(this.Visit(node.Expression)));
 }