title: Mapping results of the repositories to the AGGREGATION ENTITY in DOMAIN layer
body: <p>I'm working in a project with .NET core 3 and C# as language. 
  I'm trying to use Clean Architecture approach, CQRS and Repository Patterns. I chose DAPPER as ORM.</p>
  
  <p>I have 3 layers:</p>
  
  <ul>
  <li>DOMAIN : with my entities, aggregation entities, value object;</li>
  <li>APPLICATION : here I'm implementing the logic with QUERIES and COMMAND (CQRS) and interface (for example repositories) that I'll implement in PERSISTENCE layer;</li>
  <li>PERSISTENCE : with DAPPER, this layer share the same entities of the DOMAIN.</li>
  </ul>
  
  <p>I have doubt about how to create aggregation entity. For example:</p>
  
  <p>Class <code>Person</code> is an aggregation and a <code>Person</code> can have 1 to N<code>Photo</code></p>
  
  <pre><code>public class Person
      {
          public Person()
          {
              Photos = new HashSet&lt;PersonHasPhotos&gt;();
          }
  
          public int Id { get; set;}
          public string Name { get; set;}
  
          public ICollection&lt;PersonHasPhotos&gt; Photos  { get;  set; }
  
      }
  </code></pre>
  
  <p>Class <code>Photo</code> is normal entity</p>
  
  <pre><code>public class Photo
      {
          public Photo()
          {
          }
  
          public int Id { get; set;}
          public string Description { get; set;}
          public byte[] Photo { get; set;}
  
  
      }
  </code></pre>
  
  <p>Class <code>PersonHasPhotos</code> that specify where (the position in the screen) the Person wants to see the photo in his HOME PAGE</p>
  
  <pre><code>public class PersonHasPhotos
      {
          public PersonHasPhotos()
          {
          }
  
          public int PersonId { get; set;}
          public int PhotoId { get; set;}
          public string PositionOnTheScreen { get; set;}
  
          public Photo Photo { get; set;}
          public Person Person { get; set;}
  
  
      }
  </code></pre>
  
  <p>In my APPLICATION layer I defined one REPOSITORY for each entity. Each repository has simple job specific for the entity (only simple CRUD, without JOIN). I chose this because I'll use repositories in APPLICATION layer and there I can put logic and also manage transactions. </p>
  
  <p>I have <code>IPersonRepository</code>, <code>IPhotoRepository</code> and <code>IPersonHasPhotoRepository</code>.</p>
  
  <pre><code>public interface IPersonHasPhotosRepository
      {
          IEnumerable&lt;PersonHasPhotos&gt; GetForPerson(int PersonId);
  
      }
  
  public interface IPhotosRepository
      {
          IEnumerable&lt;Photos&gt; Get(int PersonId);
  
      }
  
  public interface IPersonRepository
      {
          Person Get(int PersonId);
  
      }
  
  </code></pre>
  
  <p>In my APPLICATION layer I have a QUERY named <code>GetPerson(int id)</code>. In the HANDLER of this query I call these repositories. </p>
  
  <p>In my PERSISTENCE layer with DAPPER I can map the results of the query directly to my entity. 
  The domain entities are shared in all layers and I don't want to put logic in PERSISTENCE layer to explain how to create aggregation entity.</p>
  
  <p>The problem is that these repositories give to me 3 different objects (<code>Person</code>, <code>List&lt;PersonHasPhoto&gt;</code>, <code>List&lt;Photo&gt;</code>) but I would like to merge them in only one object PERSON with its properties enhanced with the others objects.</p>
  
  <p>What should I do? Where am I doing wrong?</p>