예제 #1
0
        private static void ForceFillListingCache(IMemoryCache _cache)
        {
            List <Listing> listings = null;

            if (Monitor.TryEnter(locker))
            {
                using (TheAfterParty.Domain.Concrete.AppIdentityDbContext context = TheAfterParty.Domain.Concrete.AppIdentityDbContext.Create())
                {
                    TheAfterParty.Domain.Concrete.ListingRepository _repo = new TheAfterParty.Domain.Concrete.ListingRepository(new Domain.Concrete.UnitOfWork(context));

                    listings = _repo.GetListingsQuery().Where(l => l.Quantity > 0 && l.ListingPrice > 0).ToList();
                }
                //listings = storeService.GetStockedStoreListings().ToList();

                var cacheEntryOptions = new MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromSeconds(slidingCacheDuration)).SetAbsoluteExpiration(TimeSpan.FromSeconds(cacheDuration));
                _cache.Set(stockedListingsCacheKey, listings, cacheEntryOptions);

                Monitor.Exit(locker);
            }
        }
예제 #2
0
 public ListingRepository(IUnitOfWork unitOfWork)
 {
     this.context = unitOfWork.DbContext;
 }
예제 #3
0
 public UnitOfWork(AppIdentityDbContext context)
 {
     this.context = context;
 }
예제 #4
0
 public AuctionRepository(IUnitOfWork unitOfWork)
 {
     this.context = unitOfWork.DbContext;
 }
예제 #5
0
 public GiveawayRepository(IUnitOfWork unitOfWork)
 {
     this.context = unitOfWork.DbContext;
 }
예제 #6
0
 public SiteRepository(IUnitOfWork unitOfWork)
 {
     this.context = unitOfWork.DbContext;
 }
예제 #7
0
 public UserRepository(IUnitOfWork unitOfWork) : this(new AppUserManager(new UserStore <AppUser>(unitOfWork.DbContext)))
 {
     this.context = unitOfWork.DbContext;
 }