title: Entity Framework Core - recursive parent/child linking
body: <p>I have an &quot;account&quot; table that includes a string foreign-key (&quot;parent_guid&quot;) to its &quot;parent&quot; account (if one exists).  I would like to create an entity that knows its parent, as well as all of its children.</p>
  <p>Here is my entity:</p>
  <pre><code>[Table(name:&quot;accounts&quot;)]
  public class Account
  {
      [Key]
      public string Guid { get; set; }
      public string Name { get; set; }
  
      [Column(&quot;guid&quot;)]
      public string accountGuid { get; set; }
      
      [Column(name: &quot;parent_guid&quot;)]
      public string parentGuid { get; set; }
  
      [ForeignKey(&quot;parentGuid&quot;)]
      public Account Parent { get; set; }
  
      [InverseProperty(&quot;Parent&quot;)]
      public ICollection&lt;Account&gt; Children { get; set; }
  }
  </code></pre>
  <p>Here's my dbContext:</p>
  <pre><code>public DbSet&lt;Split&gt; Splits { get; set; }
  public DbSet&lt;Account&gt; Accounts { get; set; }
  
  public ReportContext(DbContextOptions&lt;ReportContext&gt; options)
      : base(options)
      { }
  </code></pre>
  <p>My query is through the 'splits' context as the source table, but I end up returning Accounts.  Maybe there's a better way?</p>
  <p>When I query for an Account by Guid, I get a result, but 'Parent' and 'Children' are always null, even though 'parentGuid' contains the correct value, and I have confirmed that there should be child records.</p>
  <p>Any idea how to make this work, either through annotations or fluent API?</p>