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

            StaffType tmpClass = null;

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

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

            return(obj);
        }
Beispiel #2
0
 public StaffType(StaffType objectToCopy)
 {
     Name        = objectToCopy.Name;
     StaffTypeID = objectToCopy.StaffTypeID;
 }