示例#1
0
        /// <summary>
        /// Performs a raw, unfiltered search at the SPI level,
        /// eliminating duplicates from the result set.
        /// </summary>
        /// <param name="search">The search SPI</param>
        /// <param name="oclass">The object class - passed through to
        /// connector so it may be null if the connecor
        /// allowing it to be null. (This is convenient for
        /// unit tests, but will not be the case in general)</param>
        /// <param name="filter">The filter to search on</param>
        /// <param name="handler">The result handler</param>
        /// <param name="options">The options - may be null - will
        /// be cast to an empty OperationOptions</param>
        public SearchResult Search <T>(SearchOp <T> search,
                                       ObjectClass objectClass,
                                       Filter filter,
                                       ResultsHandler handler,
                                       OperationOptions options) where T : class
        {
            Assertions.NullCheck(objectClass, "objectClass");
            if (ObjectClass.ALL.Equals(objectClass))
            {
                throw new System.NotSupportedException("Operation is not allowed on __ALL__ object class");
            }
            Assertions.NullCheck(handler, "handler");
            //convert null into empty
            if (options == null)
            {
                options = new OperationOptionsBuilder().Build();
            }

            SearchResult result = null;

            RawSearcherImpl <T> .RawSearch(search, objectClass, filter, new SearchResultsHandler()
            {
                Handle = obj =>
                {
                    return(handler.Handle(obj));
                },
                HandleResult = obj =>
                {
                    result = obj;
                }
            }, options);

            return(result != null ? result : new SearchResult());
        }
示例#2
0
 /// <summary>
 /// Performs a raw, unfiltered search at the SPI level,
 /// eliminating duplicates from the result set.
 /// </summary>
 /// <param name="search">The search SPI</param>
 /// <param name="oclass">The object class - passed through to
 /// connector so it may be null if the connecor
 /// allowing it to be null. (This is convenient for
 /// unit tests, but will not be the case in general)</param>
 /// <param name="filter">The filter to search on</param>
 /// <param name="handler">The result handler</param>
 /// <param name="options">The options - may be null - will
 /// be cast to an empty OperationOptions</param>
 public void Search <T>(SearchOp <T> search,
                        ObjectClass oclass,
                        Filter filter,
                        ResultsHandler handler,
                        OperationOptions options) where T : class
 {
     if (options == null)
     {
         options = new OperationOptionsBuilder().Build();
     }
     RawSearcherImpl <T> .RawSearch(
         search, oclass, filter, handler, options);
 }