Пример #1
0
        public static ShowcaseAttributeValue GetByID(int ShowcaseAttributeValueID, IEnumerable <string> includeList = null)
        {
            ShowcaseAttributeValue obj = null;
            string key = cacheKeyPrefix + ShowcaseAttributeValueID + GetCacheIncludeText(includeList);

            ShowcaseAttributeValue tmpClass = null;

            if (Cache.IsEnabled)
            {
                if (Cache.IsEmptyCacheItem(key))
                {
                    return(null);
                }
                tmpClass = Cache[key] as ShowcaseAttributeValue;
            }

            if (tmpClass != null)
            {
                obj = tmpClass;
            }
            else
            {
                using (Entities entity = new Entities())
                {
                    IQueryable <ShowcaseAttributeValue> itemQuery = AddIncludes(entity.ShowcaseAttributeValue, includeList);
                    obj = itemQuery.FirstOrDefault(n => n.ShowcaseAttributeValueID == ShowcaseAttributeValueID);
                }
                Cache.Store(key, obj);
            }

            return(obj);
        }
Пример #2
0
 public ShowcaseAttributeValue(ShowcaseAttributeValue objectToCopy)
 {
     DisplayInFilters         = objectToCopy.DisplayInFilters;
     DisplayOrder             = objectToCopy.DisplayOrder;
     ShowcaseAttributeID      = objectToCopy.ShowcaseAttributeID;
     ShowcaseAttributeValueID = objectToCopy.ShowcaseAttributeValueID;
     UpperRangeValue          = objectToCopy.UpperRangeValue;
     Value = objectToCopy.Value;
 }