title: Why is Entity Framework core loading entity's relations without adding include
body: <p>I'm using EF core in a .net core project. After fetching data from ef context, the object's entity's (one-to-many etc...) are automatically loaded.</p>
  
  <p>Here's my code:</p>
  
  <pre class="lang-cs prettyprint-override"><code> public TimeSheetActivity Get(int id)
   {
       DataSets.TimeSheetActivity dbActivity = db.TimeSheetActivities
                                                 .Include(k =&gt; k.ProjectFile)
                                                 .Include(k =&gt; k.MeasurementUnit)
                                                 .Include(k =&gt; k.TypeOfWork)
                                                 .Include(k =&gt; k.TimeSheetProject)
                                                 .FirstOrDefault(k =&gt; k.ID == id);
  
       return dbActivity == null ? null : _mapper.Map&lt;TimeSheetActivity&gt;(dbActivity);
   }
  
  
  public Project GetActivityProject(int id)
  {
      //db.SaveChanges();
  
      TimeSheetActivity activity = Get(id);
  
      if (activity == null)
      {
          return null;
      }
  
      var dbTimeSheetProject = db.TimeSheetProjects.First(k =&gt; k.ID == activity.TimeSheetProjectId);
  
      var dbProject = db.Projects.First(k =&gt; k.ID == dbTimeSheetProject.ProjectId);
      // PROBLEM HERE &gt;&gt; dbProject is loading all entities related
      return _mapper.Map&lt;Project&gt;(dbProject);
  }
  
  </code></pre>
  
  <p>The problem is marked above and commented in <code>Projects</code> context, here's the project class: </p>
  
  <pre class="lang-cs prettyprint-override"><code>public class Project
      {
          public int ID { get; set; }
          public string Title { get; set; }
          public string Description { get; set; }
          public DateTime DateAdded { get; set; }
  
          public int? ParentId { get; set; }
          public int? DepartmentId { get; set; }
          public int? CompanyId { get; set; }
  
  
          public virtual Department Department { get; set; }
          public virtual Company Company { get; set; }
  
          public virtual Project Parent { get; set; }
  
          public virtual List&lt;Project&gt; Activities { get; set; }
          public virtual List&lt;TimeSheetProject&gt; TimeSheetProjects { get; set; }
          public virtual List&lt;ProjectFile&gt; ProjectFiles { get; set; }
  
      }
  
  </code></pre>
  
  <p>Debugging capture:</p>
  
  <p><a href="https://i.stack.imgur.com/60D79.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/60D79.png" alt="Debug"></a></p>