Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2014
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. public interface DataService {
  2.  
  3. InsuranceClaim[] FindClaims(Customer customer);
  4.  
  5. }
  6.  
  7. public class Repository {
  8.  
  9. public DataService InnerService { get; set; }
  10.  
  11. }
  12.  
  13. public class ClassThatNeedsInsuranceClaim {
  14.  
  15. private Repository _repository;
  16.  
  17. public ClassThatNeedsInsuranceClaim(Repository repository) {
  18.  
  19. _repository = repository;
  20.  
  21. }
  22.  
  23. public void TallyAllTheOutstandingClaims(Customer customer) {
  24.  
  25. // This line of code violates the Law of Demeter
  26.  
  27. InsuranceClaim[] claims =
  28.  
  29. _repository.InnerService.FindClaims(customer);
  30.  
  31. }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement