public static UserOffice GetByID(int UserOfficeID, IEnumerable <string> includeList = null) { UserOffice obj = null; string key = cacheKeyPrefix + UserOfficeID + GetCacheIncludeText(includeList); UserOffice tmpClass = null; if (Cache.IsEnabled) { if (Cache.IsEmptyCacheItem(key)) { return(null); } tmpClass = Cache[key] as UserOffice; } if (tmpClass != null) { obj = tmpClass; } else { using (Entities entity = new Entities()) { IQueryable <UserOffice> itemQuery = AddIncludes(entity.UserOffice, includeList); obj = itemQuery.FirstOrDefault(n => n.UserOfficeID == UserOfficeID); } Cache.Store(key, obj); } return(obj); }
public UserOffice(UserOffice objectToCopy) { MlsID = objectToCopy.MlsID; OfficeID = objectToCopy.OfficeID; UserID = objectToCopy.UserID; UserOfficeID = objectToCopy.UserOfficeID; }