title: Entity framework core relationship collection is empty
body: <p>I did do a database first approach, and I did make my database. I use relationship and I have two tables:</p>
  
  <pre><code>users
  -------------
  id PK int(11)
  username UNIQUE varchar(20)
  
  rooms
  -------------
  id PK int(11)
  name VARCHAR(30) NOT NULL
  owner_id INDEX int(11) -&gt; FK to users.id
  </code></pre>
  
  <p>When I do a scaffold, the models look a little like this:</p>
  
  <p>User.cs:</p>
  
  <pre><code>public User()
  {
      Rooms = new HashSet&lt;Room&gt;();
  }
  
  public int Id { get; set; }
  public string Username { get; set; }
  public virtual ICollection&lt;Room&gt; Rooms { get; set; }
  </code></pre>
  
  <p>Room.cs:</p>
  
  <pre><code>public int Id { get; set; }
  public string Name { get; set; }
  public int? OwnerId { get; set; }
  
  public virtual User Owner { get; set; }
  </code></pre>
  
  <p>(the OwnerId is nullable since system rooms don't have an assigned owner)</p>
  
  <p>The problem is, if I have my user object obtained when logging in, and I view <code>user.Rooms</code>, the collection is always empty, even though the database has an entry.</p>
  
  <p>I know include fixes this, but that makes me have to load ALL rooms from the database, which is a terrible idea when there's like 1000+ rooms being loaded on start of the program.</p>
  
  <p>Why is the collection always empty even though the relationships are setup correctly?</p>