Beispiel #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;
        }
Beispiel #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
                           )
                       ));
        }
Beispiel #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
                    ));
     }
 }
Beispiel #4
0
 public DirectorySearcherExpression Update(Expression filter, IEnumerable <LdapAttributeExpression> attributesToLoad, LdapSortExpression sort)
 {
     return(this.Update(filter, attributesToLoad, sort, this.Skip, this.Take));
 }
 protected virtual Expression VisitSort(LdapSortExpression node)
 {
     return(node.Update(this.Visit(node.Expression)));
 }