Exemple #1
0
        /// <summary>
        /// Loads a lookup table for the specified type into the given lookup cache.
        /// Implementation of the corresponding interface method.
        /// </summary>
        /// <param name="cache">The lookup cache where to populate the lookup table.</param>
        /// <param name="tableType">The type of the lookup table to populate.</param>
        /// <param name="token">Cancellation token.</param>
        public virtual async Task LoadAsync(LookupCache cache, string tableType, CancellationToken token = default)
        {
            void cacheUpdater(LookupTable table)
            {
                cache.CacheLookupTable(table);
                // ensure supportedTypes gets populated
                if (supportedTypes == null)
                {
                    supportedTypes = new HashSet <string>();
                }
                supportedTypes.Add(table.Type);
            }

            await LoadCacheAsync(tableType, cacheUpdater, token);
        }
Exemple #2
0
        /// <summary>
        /// Loads a lookup table for the specified type into the given lookup cache.
        /// Implementation of the corresponding interface method.
        /// </summary>
        /// <param name="cache">The lookup cache where to populate the lookup table.</param>
        /// <param name="tableType">The type of the lookup table to populate.</param>
        public virtual void Load(LookupCache cache, string tableType)
        {
            if (!IsSupported(cache.CacheType, tableType))
            {
                return;
            }

            LoadCache(tableType, delegate(LookupTable table) {
                cache.CacheLookupTable(table);
                // ensure supportedTypes gets populated
                if (supportedTypes == null)
                {
                    supportedTypes = new List <string>();
                }
                if (!supportedTypes.Contains(table.Type))
                {
                    supportedTypes.Add(table.Type);
                }
            });
        }
        /// <summary>
        /// Loads a lookup table for the specified type into the given lookup cache.
        /// Implementation of the corresponding interface method.
        /// </summary>
        /// <param name="cache">The lookup cache where to populate the lookup table.</param>
        /// <param name="tableType">The type of the lookup table to populate.</param>
        public virtual void Load(LookupCache cache, string tableType)
        {
            if (!IsSupported(cache.CacheType, tableType)) return;

            LoadCache(tableType, delegate (LookupTable table) {
                cache.CacheLookupTable(table);
                // ensure supportedTypes gets populated
                if (supportedTypes == null) supportedTypes = new List<string>();
                if (!supportedTypes.Contains(table.Type)) supportedTypes.Add(table.Type);
            });
        }