示例#1
0
        /// <summary>
        /// Process a collection of <see cref="IInvocableCacheEntry"/>
        /// objects.
        /// </summary>
        /// <param name="entries">
        /// A read-only collection of <b>IInvocableCacheEntry</b>
        /// objects to process.
        /// </param>
        /// <returns>
        /// An empty, immutable dictionary.
        /// </returns>
        public override IDictionary ProcessAll(ICollection entries)
        {
            IDictionary dictionary = m_dictionary;
            IFilter     filter     = m_filter;

            foreach (IInvocableCacheEntry entry in entries)
            {
                object key = entry.Key;
                if (dictionary.Contains(key) && InvocableCacheHelper.EvaluateEntry(filter, entry))
                {
                    entry.SetValue(dictionary[key], false);
                }
            }
            return(NullImplementation.GetDictionary());
        }
        /// <summary>
        /// Obtain the result of the aggregation.
        /// </summary>
        /// <remarks>
        /// If the <paramref name="isFinal"/> parameter is <b>true</b>, the
        /// returned object must be the final result of the aggregation;
        /// otherwise, the returned object will be treated as a partial
        /// result that should be incorporated into the final result.
        /// </remarks>
        /// <param name="isFinal">
        /// <b>true</b> to indicate that the final result of the aggregation
        /// process should be returned; this will only be <b>false</b> if a
        /// parallel approach is being used.
        /// </param>
        /// <returns>
        /// The result of the aggregation process.
        /// </returns>
        protected override object FinalizeResult(bool isFinal)
        {
            IDictionary map = m_map;

            m_map = null;

            if (isFinal)
            {
                // return the final aggregated result
                return(map == null?NullImplementation.GetDictionary() : map);
            }
            else
            {
                // return partial aggregation data
                return(map);
            }
        }
 /// <summary>
 /// Process a collection of <see cref="IInvocableCacheEntry"/>
 /// objects.
 /// </summary>
 /// <param name="entries">
 /// A read-only collection of <b>IInvocableCacheEntry</b>
 /// objects to process.
 /// </param>
 /// <returns>
 /// An empty, immutable dictionary.
 /// </returns>
 public override IDictionary ProcessAll(ICollection entries)
 {
     base.ProcessAll(entries);
     return(NullImplementation.GetDictionary());
 }