// Token: 0x06001A8E RID: 6798 RVA: 0x0006F320 File Offset: 0x0006D520
        private Result <TEntry> LookUpRecipientInAD(ProxyAddress proxyAddress, ADPropertyDefinition[] properties)
        {
            if (ADRecipientCache <TEntry> .PerfCounters != null)
            {
                ADRecipientCache <TEntry> .PerfCounters.IndividualAddressLookupsTotal.Increment();

                ADRecipientCache <TEntry> .PerfCounters.RequestsPendingTotal.Increment();

                ADRecipientCache <TEntry> .PerfCounters.AggregateLookupsTotal.Increment();

                this.IncrementQueriesPerCacheCounter();
            }
            ComponentTrace <ADRecipientCacheTags> .TraceDebug <ProxyAddress>(0, -1L, "Lookup recipient {0}", proxyAddress);

            TEntry    entry     = default(TEntry);
            Stopwatch stopwatch = Stopwatch.StartNew();

            try
            {
                ADNotificationAdapter.RunADOperation(delegate()
                {
                    if (typeof(TEntry) == typeof(ADRawEntry))
                    {
                        entry = (TEntry)((object)this.ADSession.FindByProxyAddress(proxyAddress, properties));
                        return;
                    }
                    if (typeof(TEntry) == typeof(TransportMiniRecipient))
                    {
                        entry = (this.ADSession.FindByProxyAddress <TransportMiniRecipient>(proxyAddress) as TEntry);
                        return;
                    }
                    throw new NotSupportedException();
                });
                if (entry == null)
                {
                    return(new Result <TEntry>(default(TEntry), ProviderError.NotFound));
                }
            }
            catch (DataValidationException ex)
            {
                ComponentTrace <ADRecipientCacheTags> .TraceError <DataValidationException>(0, -1L, "DataValidationException: {0}", ex);

                return(new Result <TEntry>(default(TEntry), ex.Error));
            }
            finally
            {
                stopwatch.Stop();
                if (ADRecipientCache <TEntry> .PerfCounters != null)
                {
                    ADRecipientCache <TEntry> .PerfCounters.AverageLookupQueryLatency.IncrementBy(stopwatch.ElapsedMilliseconds);
                }
                ADRecipientCache <TEntry> .DecrementPendingRequestsCounter();
            }
            return(new Result <TEntry>(entry, null));
        }
        // Token: 0x06001A76 RID: 6774 RVA: 0x0006E40C File Offset: 0x0006C60C
        public virtual Result <TEntry> FindAndCacheRecipient(ADObjectId objectId)
        {
            if (objectId == null)
            {
                throw new ArgumentNullException("objectId");
            }
            if (ADRecipientCache <TEntry> .PerfCounters != null)
            {
                ADRecipientCache <TEntry> .PerfCounters.IndividualAddressLookupsTotal.Increment();

                ADRecipientCache <TEntry> .PerfCounters.RequestsPendingTotal.Increment();

                ADRecipientCache <TEntry> .PerfCounters.AggregateHits_Base.Increment();

                ADRecipientCache <TEntry> .PerfCounters.AggregateMisses.Increment();

                ADRecipientCache <TEntry> .PerfCounters.AggregateLookupsTotal.Increment();

                this.IncrementQueriesPerCacheCounter();
            }
            Stopwatch       stopwatch = Stopwatch.StartNew();
            Result <TEntry> result;

            try
            {
                TEntry entry = default(TEntry);
                ADNotificationAdapter.RunADOperation(delegate()
                {
                    if (typeof(TEntry) == typeof(TransportMiniRecipient))
                    {
                        entry = (this.ADSession.ReadMiniRecipient <TransportMiniRecipient>(objectId, this.properties) as TEntry);
                        return;
                    }
                    if (this.isFullADRecipientObject)
                    {
                        entry = (TEntry)((object)this.ADSession.Read(objectId));
                        return;
                    }
                    entry = (TEntry)((object)this.ADSession.ReadADRawEntry(objectId, this.properties));
                });
                if (entry == null)
                {
                    result = new Result <TEntry>(default(TEntry), ProviderError.NotFound);
                }
                else
                {
                    result = new Result <TEntry>(entry, null);
                }
            }
            catch (DataValidationException ex)
            {
                ComponentTrace <ADRecipientCacheTags> .TraceError <DataValidationException>(0, -1L, "DataValidationException: {0}", ex);

                result = new Result <TEntry>(default(TEntry), ex.Error);
            }
            finally
            {
                stopwatch.Stop();
                if (ADRecipientCache <TEntry> .PerfCounters != null)
                {
                    ADRecipientCache <TEntry> .PerfCounters.AverageLookupQueryLatency.IncrementBy(stopwatch.ElapsedMilliseconds);
                }
                ADRecipientCache <TEntry> .DecrementPendingRequestsCounter();
            }
            if (result.Data != null)
            {
                ProxyAddress primarySmtpAddress = ADRecipientCache <TEntry> .GetPrimarySmtpAddress(result.Data);

                if (primarySmtpAddress != null)
                {
                    this.AddCacheEntry(primarySmtpAddress, result);
                }
            }
            return(result);
        }