Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface ICustomerRepository
- {
- Customer RetrieveById(string id);
- }
- public class CustomerSessionCacheRepository(ICustomerRepository innerRepository) : ICustomerRepository
- {
- public Customer RetrieveById(string id)
- {
- if (_cache.Contains(id))
- return _cache[id];
- else
- {
- var data = innerRepository.RetrieveById(id);
- _cache[id] = data;
- return data;
- }
- }
- }
- public class CustomerSessionCacheRepository()
- {
- public Customer RetrieveById(string id)
- {
- // NHibernate Magic to get the record...
- }
- }
Add Comment
Please, Sign In to add comment