Guest User

Untitled

a guest
Aug 14th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. What does a repository look like when using many 1:Many or Many:Many tables?
  2. namespace MVCAzureStore.Services.Caching
  3. {
  4. public class CachedProductsRepository : CachedDataSource, IProductRepository
  5. {
  6. private readonly IProductRepository repository;
  7.  
  8. public CachedProductsRepository(IProductRepository repository, ObjectCache cacheProvider) :
  9. base(cacheProvider, "Products")
  10. {
  11. this.repository = repository;
  12. }
  13.  
  14. public List<string> GetProducts()
  15. {
  16. return RetrieveCachedData(
  17. "allproducts", () => this.repository.GetProducts(),
  18. new CacheItemPolicy { AbsoluteExpiration = DateTime.UtcNow.AddMinutes(1) });
  19. }
  20. }
  21. }
Add Comment
Please, Sign In to add comment