Guest User

Untitled

a guest
Jun 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. public interface ICustomerRepository
  2. {
  3. Customer RetrieveById(string id);
  4. }
  5.  
  6. public class CustomerSessionCacheRepository(ICustomerRepository innerRepository) : ICustomerRepository
  7. {
  8. public Customer RetrieveById(string id)
  9. {
  10. if (_cache.Contains(id))
  11. return _cache[id];
  12. else
  13. {
  14. var data = innerRepository.RetrieveById(id);
  15. _cache[id] = data;
  16. return data;
  17. }
  18. }
  19. }
  20.  
  21.  
  22. public class CustomerSessionCacheRepository()
  23. {
  24. public Customer RetrieveById(string id)
  25. {
  26. // NHibernate Magic to get the record...
  27. }
  28. }
Add Comment
Please, Sign In to add comment