Пример #1
0
        protected virtual Dictionary <int, TValueType> LoadCacheDictionary()
        {
            Dictionary <int, string> mappings = GetCodeMapping();

            var items            = new Dictionary <int, TValueType>();
            var notFoundCctCodes = "";

            foreach (var mapping in mappings)
            {
                try
                {
                    items.Add(mapping.Key, (TValueType)EnumUtility.EnumValueOfCttCode(mapping.Value, typeof(TValueType)));
                }
                catch (UnexpectedCctCodeException ex)
                {
                    // We have encountered an item whose CCT Code we do not yet have in our enumeration.
                    notFoundCctCodes += ex.CctCode + ";";
                }
            }

            //if (notFoundCctCodes.Length > 0)
            //{
            //    var logger = LogManager.GetLogger<TCacheType>();
            //    logger.WarnFormat("The following cctCode values do not exist for specified enum {0}: {1}",
            //        typeof(TValueType).Name, notFoundCctCodes);
            //}

            return(items);
        }