title: Does including Collections in Entities violate what an entity is supposed to be?
body: <p>I am building a Web API using Dapper for .NET Core and trying to adhere to Clean Architecture principles. The API is consumed by an external Angular front-end.</p>
  <p>I have repositories that use Dapper to retrieve data from the database, and this data then passes through a service to be mapped into a DTO for display to the user.</p>
  <p>It is my understanding that an entity should be an <strong>exact</strong> representation of the database object, with no extra properties, and that I should use DTOs if I require some additional properties to show the user (or if I wish to obscure certain properties from the user too).</p>
  <p>Suppose I have a DTO:</p>
  <pre class="lang-csharp prettyprint-override"><code>public class StudentDTO
  {
    public Guid Id { get; set; }
    public string Name { get; set; }
    public List&lt;Assignment&gt; Assignments { get; set;}
  }
  </code></pre>
  <p>and its corresponding Entity:</p>
  <pre class="lang-csharp prettyprint-override"><code>public class Student
  {
    public Guid Id { get; set; }
    public string Name { get; set; }
  }
  </code></pre>
  <p>With this model, should I want to get a student with all of their assignments, I'd need to have two repository calls, and do something like this in the service:</p>
  <pre class="lang-csharp prettyprint-override"><code>public StudentDTO GetById(Guid id) 
  {
    var student = this.studentRepository.GetById(id);
    var assignments = this.assignmentRepository.GetByStudentId(id);
    return SomeMapperClass.Map(student, assignments);
  }
  </code></pre>
  <p>But this seems inefficient and unnecessary. My question is, should I not just retrieve the Assignments when I get the student entity in the repository, using a JOIN? Or would this violate what an entity is supposed to be?</p>
  <p>I apologise, I do realise this is a rather simple question, but I'd really like to know which method is the best approach, or if they both have their use cases</p>