Example #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);
            }
        }
 public ListingRepository(IUnitOfWork unitOfWork)
 {
     this.context = unitOfWork.DbContext;
 }
Example #3
0
 public UnitOfWork(AppIdentityDbContext context)
 {
     this.context = context;
 }
 public AuctionRepository(IUnitOfWork unitOfWork)
 {
     this.context = unitOfWork.DbContext;
 }
 public GiveawayRepository(IUnitOfWork unitOfWork)
 {
     this.context = unitOfWork.DbContext;
 }
Example #6
0
 public SiteRepository(IUnitOfWork unitOfWork)
 {
     this.context = unitOfWork.DbContext;
 }
Example #7
0
 public UserRepository(IUnitOfWork unitOfWork) : this(new AppUserManager(new UserStore <AppUser>(unitOfWork.DbContext)))
 {
     this.context = unitOfWork.DbContext;
 }