示例#1
0
        public static SiteSettingsDataType GetByID(int SiteSettingsDataTypeID, IEnumerable <string> includeList = null)
        {
            SiteSettingsDataType obj = null;
            string key = cacheKeyPrefix + SiteSettingsDataTypeID + GetCacheIncludeText(includeList);

            SiteSettingsDataType tmpClass = null;

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

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

            return(obj);
        }
示例#2
0
 public SiteSettingsDataType(SiteSettingsDataType objectToCopy)
 {
     SiteSettingsDataTypeID = objectToCopy.SiteSettingsDataTypeID;
     Type = objectToCopy.Type;
 }