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