title: Automapper self referencing model projection
body: <p>I've got a problem handling self referencing model in my application using Automapper Projections. This is how my models look like:</p>
  
  <pre><code>public class Letter 
  {
      public int? ParentId {get; set;}
  
      public Letter ParentLetter {get; set;
  
      public int Id {get; set;}
  
      public string Title {get; set;}
  
      public string Content {get; set;}
  
      public DateTime? ReceivedTime {get; set;}
  
      public DateTime? SendingTime {get; set;}
  
      public List&lt;Destination&gt; Destinations {get; set;}
  
      public List&lt;Letter&gt; Responses {get; set;}
  }
  
  public class LetterView 
  {
      public int? ParentId {get; set;}
  
      public int Id {get; set;}
  
      public string Title {get; set;}
  
      public string Content {get; set;}
  
      public DateTime? ReceivedTime {get; set;}
  
      public DateTime? SendingTime {get; set;}
  
      public List&lt;DestinationView&gt; Destinations {get; set;}
  
      public List&lt;LetterView&gt; Responses {get; set;}
  }
  
  
  public class Destination 
  {
      public int Id {get; set;}
  
      public string Name {get; set;}
  
      ..
  }
  
  public class DestinationView 
  {
      public int Id {get; set;}
  
      public string Name {get; set;}
  }
  
  // The mapping:
  
  CreateMap&lt;Destination, DestinationView&gt;
  CreateMap&lt;Letter, LetterView&gt;
  </code></pre>
  
  <p>My problem is with mapping Letter to LetterView. The problem is somewhere with the Responses, I just can't figure out what should be changed.</p>
  
  <p>Whenever running unit tests and asserting mapping configurations everything works, as well as mapping a letter with multiple responses to a view model.
  However, whenever I get a letter with it's resposnes from the database (Entity framework 6), the projection to LetterView throws a stackoverflow exception.</p>
  
  <p>Can anyone please explain me why this happens only on projection? What should I change?</p>