Example #1
0
        public static BuilderMicrosite GetByID(int BuilderMicrositeID, IEnumerable <string> includeList = null)
        {
            BuilderMicrosite obj = null;
            string           key = cacheKeyPrefix + BuilderMicrositeID + GetCacheIncludeText(includeList);

            BuilderMicrosite tmpClass = null;

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

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

            return(obj);
        }
Example #2
0
 public BuilderMicrosite(BuilderMicrosite objectToCopy)
 {
     BuilderID          = objectToCopy.BuilderID;
     BuilderMicrositeID = objectToCopy.BuilderMicrositeID;
     CMMicrositeID      = objectToCopy.CMMicrositeID;
 }