コード例 #1
0
        public static NewsletterActionType GetByID(int NewsletterActionTypeID, IEnumerable <string> includeList = null)
        {
            NewsletterActionType obj = null;
            string key = cacheKeyPrefix + NewsletterActionTypeID + GetCacheIncludeText(includeList);

            NewsletterActionType tmpClass = null;

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

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

            return(obj);
        }
コード例 #2
0
 public NewsletterActionType(NewsletterActionType objectToCopy)
 {
     DisplayName            = objectToCopy.DisplayName;
     NewsletterActionTypeID = objectToCopy.NewsletterActionTypeID;
     Type = objectToCopy.Type;
 }