Пример #1
0
        //Generate test data
        private IQueryable <LocationMaster> GenerateAttendees()
        {
            //Check cache first before regenerating test data
            string cacheKey = "attendees";

            if (HttpContext.Current.Cache[cacheKey] != null)
            {
                return((IQueryable <LocationMaster>)HttpContext.Current.Cache[cacheKey]);
            }

            var attendees = uow.Repository <LocationMaster>().GetAll().ToList();

            //for (int i = 0; i < 1000; i++)
            //{
            //    attendees.Add(
            //        new LocationMaster()
            //        {
            //            AttendeeId = i,
            //            FirstName = "First " + i.ToString(),
            //            LastName = "Last " + i.ToString()
            //        }
            //        );
            //}

            var result = attendees.AsQueryable();

            //Cache results
            HttpContext.Current.Cache[cacheKey] = result;

            return(result);
        }
Пример #2
0
        //Generate test data
        private IQueryable <WeekDayList> GenerateWeeks()
        {
            //Check cache first before regenerating test data
            string cacheKey = "weekdays";

            if (HttpContext.Current.Cache[cacheKey] != null)
            {
                return((IQueryable <WeekDayList>)HttpContext.Current.Cache[cacheKey]);
            }

            var attendees = uow.Repository <WeekDayList>().GetAll().ToList();



            var result = attendees.AsQueryable();

            //Cache results
            HttpContext.Current.Cache[cacheKey] = result;

            return(result);
        }