Beispiel #1
0
 public object GetUnderlyingSearcher()
 {
     this.CheckDisposed();
     if (this.qbeFilter != null)
     {
         if (this.qbeFilter.unpersisted)
         {
             if (!this.HasReferentialPropertiesSet())
             {
                 StoreCtx queryCtx = this.ctx.QueryCtx;
                 if (queryCtx.SupportsSearchNatively)
                 {
                     this.underlyingSearcher = queryCtx.PushFilterToNativeSearcher(this);
                     return(this.underlyingSearcher);
                 }
                 else
                 {
                     throw new InvalidOperationException(StringResources.PrincipalSearcherNoUnderlying);
                 }
             }
             else
             {
                 throw new InvalidOperationException(StringResources.PrincipalSearcherNonReferentialProps);
             }
         }
         else
         {
             throw new InvalidOperationException(StringResources.PrincipalSearcherPersistedPrincipal);
         }
     }
     else
     {
         throw new InvalidOperationException(StringResources.PrincipalSearcherMustSetFilter);
     }
 }
        public object GetUnderlyingSearcher()
        {
            GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalSearcher", "Entering GetUnderlyingSearcher");

            CheckDisposed();

            // We have to have a filter
            if (_qbeFilter == null)
            {
                throw new InvalidOperationException(StringResources.PrincipalSearcherMustSetFilter);
            }

            // Double-check that the Principal isn't persisted.  We don't allow them to assign a persisted
            // Principal as the filter, but they could have persisted it after assigning it to the QueryFilter
            // property.
            if (!_qbeFilter.unpersisted)
            {
                throw new InvalidOperationException(StringResources.PrincipalSearcherPersistedPrincipal);
            }

            // Validate the QBE filter: make sure it doesn't have any non-scalar properties set.
            if (HasReferentialPropertiesSet())
            {
                throw new InvalidOperationException(StringResources.PrincipalSearcherNonReferentialProps);
            }

            StoreCtx storeCtx = _ctx.QueryCtx;

            Debug.Assert(storeCtx != null);

            // The underlying context must actually support search (i.e., no MSAM/reg-SAM)
            if (storeCtx.SupportsSearchNatively == false)
            {
                throw new InvalidOperationException(StringResources.PrincipalSearcherNoUnderlying);
            }

            // We need to generate the searcher every time because the object could change
            // outside of our control.
            _underlyingSearcher = storeCtx.PushFilterToNativeSearcher(this);

            return(_underlyingSearcher);
        }