コード例 #1
0
        public GenericControlValue GetById(int id, bool isCache = true)
        {
            GenericControlValue genericControlValue;

            if (isCache)
            {
                var sbKey = new StringBuilder();
                sbKey.AppendFormat(CacheGenericontrolvalueKey, "GetById");
                sbKey.Append(id);

                var key = sbKey.ToString();
                genericControlValue = _cacheManager.Get <GenericControlValue>(key);
                if (genericControlValue == null)
                {
                    genericControlValue = _attributeValueRepository.GetById(id);
                    _cacheManager.Put(key, genericControlValue);
                }
            }
            else
            {
                genericControlValue = _attributeValueRepository.GetById(id);
            }

            return(genericControlValue);
        }