Пример #1
0
        internal static TReturnValue TranslateXsoExceptionsWithReturnValue <TReturnValue>(IDiagnosticsSession tracer, LocalizedString errorString, XsoUtil.XsoExceptionHandlingFlags flags, Func <TReturnValue> xsoCall)
        {
            TReturnValue result = default(TReturnValue);

            XsoUtil.TranslateXsoExceptions(tracer, errorString, flags, delegate()
            {
                result = xsoCall();
            });
            return(result);
        }
Пример #2
0
            private object[][] GetRowsFromQuery(ref Folder folder, ref QueryResult result, TSort lastReturnedSortKey, int lastReturnedDocumentId)
            {
                QueryResult tempQueryResult = result;
                Folder      tempFolder      = folder;

                folder = null;
                result = null;
                object[][] result2;
                using (DisposeGuard disposeGuard = default(DisposeGuard))
                {
                    if (tempFolder == null)
                    {
                        tempFolder = XsoUtil.TranslateXsoExceptionsWithReturnValue <Folder>(this.diagnosticsSession, Strings.ConnectionToMailboxFailed(this.session.MailboxGuid), () => Folder.Bind(this.session, this.folderId));
                        if (tempFolder == null)
                        {
                            return(CrawlerItemIterator <TSort> .QueryResultWrapper.EmptyResult);
                        }
                        disposeGuard.Add <Folder>(tempFolder);
                        tempQueryResult = XsoUtil.TranslateXsoExceptionsWithReturnValue <QueryResult>(this.diagnosticsSession, Strings.ConnectionToMailboxFailed(this.session.MailboxGuid), XsoUtil.XsoExceptionHandlingFlags.DoNotExpectObjectNotFound, () => tempFolder.ItemQuery(ItemQueryType.None, null, this.sortOrder, this.propertiesToRequest));
                        if (tempQueryResult == null)
                        {
                            return(CrawlerItemIterator <TSort> .QueryResultWrapper.EmptyResult);
                        }
                        disposeGuard.Add <QueryResult>(tempQueryResult);
                        bool isSeekSuccessful = false;
                        XsoUtil.TranslateXsoExceptions(this.diagnosticsSession, Strings.ConnectionToMailboxFailed(this.session.MailboxGuid), XsoUtil.XsoExceptionHandlingFlags.DoNotExpectObjectNotFound | XsoUtil.XsoExceptionHandlingFlags.DoNotExpectCorruptData, delegate()
                        {
                            if (this.sortProperty == ItemSchema.DocumentId)
                            {
                                tempQueryResult.SeekToCondition(SeekReference.OriginBeginning, new ComparisonFilter(this.isAscending ? ComparisonOperator.GreaterThan : ComparisonOperator.LessThan, ItemSchema.DocumentId, lastReturnedSortKey), SeekToConditionFlags.None);
                            }
                            else
                            {
                                tempQueryResult.SeekToCondition(SeekReference.OriginBeginning, new OrFilter(new QueryFilter[]
                                {
                                    new AndFilter(new QueryFilter[]
                                    {
                                        new ComparisonFilter(this.isAscending ? ComparisonOperator.GreaterThanOrEqual : ComparisonOperator.LessThanOrEqual, this.sortProperty, lastReturnedSortKey),
                                        new ComparisonFilter(ComparisonOperator.GreaterThan, ItemSchema.DocumentId, lastReturnedDocumentId)
                                    }),
                                    new ComparisonFilter(this.isAscending ? ComparisonOperator.GreaterThan : ComparisonOperator.LessThan, this.sortProperty, lastReturnedSortKey)
                                }), SeekToConditionFlags.AllowExtendedFilters);
                            }
                            isSeekSuccessful = true;
                        });
                        if (!isSeekSuccessful)
                        {
                            return(CrawlerItemIterator <TSort> .QueryResultWrapper.EmptyResult);
                        }
                    }
                    else
                    {
                        disposeGuard.Add <Folder>(tempFolder);
                        disposeGuard.Add <QueryResult>(tempQueryResult);
                    }
                    object[][] array = XsoUtil.TranslateXsoExceptionsWithReturnValue <object[][]>(this.diagnosticsSession, Strings.ConnectionToMailboxFailed(this.session.MailboxGuid), XsoUtil.XsoExceptionHandlingFlags.DoNotExpectObjectNotFound | XsoUtil.XsoExceptionHandlingFlags.DoNotExpectCorruptData, () => tempQueryResult.GetRows(this.maxRowCount));
                    if (array == null)
                    {
                        result2 = CrawlerItemIterator <TSort> .QueryResultWrapper.EmptyResult;
                    }
                    else
                    {
                        if (this.canCacheResult)
                        {
                            folder = tempFolder;
                            result = tempQueryResult;
                            disposeGuard.Success();
                        }
                        result2 = array;
                    }
                }
                return(result2);
            }
Пример #3
0
 internal static void TranslateXsoExceptions(IDiagnosticsSession tracer, LocalizedString errorString, Action xsoCall)
 {
     XsoUtil.TranslateXsoExceptions(tracer, errorString, XsoUtil.XsoExceptionHandlingFlags.None, xsoCall);
 }