title: Dependecy Injection: How To Overcome Cyclic Dependencies
body: <p>Thanks for reading.</p>
  
  <p>I'm using Unity framework to implement dependency injection in my app (ASP.Net MVC).
  Sometimes there are some cyclic dependencies among services that I want to avoid.</p>
  
  <p>So I'm looking for solutions : )</p>
  
  <hr>
  
  <h2><strong>My case</strong></h2>
  
  <p>well lets imagine 3 services ServiceSally, ServiceJoe, ServiceJudy</p>
  
  <p>ServiceSally depends on ServiceJoe</p>
  
  <p>ServiceJoe depends on ServiceJudy</p>
  
  <p>ServiceJudy depends on ServiceSally (&lt;&lt; That is kind of weird isn't it?)</p>
  
  <p>So if you instance ServiceSally, she will need ServiceJoe to be injected, and ServiceJoe will need ServiceJudy and.... BANG!... ServiceJudy will need ServiceSally starting an endless cycle -and very sad love triangle-.</p>
  
  <hr>
  
  <p>How could I solve this cyclic-loveTriangle case? : /</p>
  
  <p>UPDATE:</p>
  
  <p><strong>My first solution: The LazyJoe</strong></p>
  
  <p>What about to use a wrapper around the services references to delay the injection until they are used?</p>
  
  <p>What do you think?</p>