title: .net core - Model virtual property not loaded
body: <p>In my .net core 2 project, I have user and file model and they have relationship. In model and in database;</p>
  
  <p>user model :</p>
  
  <pre><code>[DefaultValue(null)]
  public int? AvatarId { get; set; }
  [ForeignKey("AvatarId")]
  public virtual File Avatar { get; set; }
  </code></pre>
  
  <p>file model :</p>
  
  <pre><code>[InverseProperty("Avatar")]
  public ICollection&lt;User&gt; Users { get; set; }
  </code></pre>
  
  <p>I get my user with this query</p>
  
  <pre><code>var user = this._db.User.Include(u =&gt; u.Avatar).FirstOrDefault(o =&gt; o.Id == id);
  </code></pre>
  
  <p>in context: </p>
  
  <pre><code>modelBuilder.Entity&lt;User&gt;()
              .HasOne&lt;File&gt;(u =&gt; u.Avatar)
              .WithMany(f =&gt; f.Users)
              .HasForeignKey(u =&gt; u.AvatarId);
  </code></pre>
  
  <p>If user have avatar or dont have a avatar, Avatar property return null.</p>