title: EntityFrameworkCore - Filter DbSet to a single property on another Entity
body: <p>I have an <code>Account</code> entity, on which I want to have a <code>Subscription</code> property called <code>CurrentSubscription</code>. </p>
  
  <pre><code>public class Account
  {
      public int Id { get; set; }
      public Subscription CurrentSubscription { get; set; }
  }
  
  public class Subscription
  {
      public int Id { get; set; }
      public int AccountId { get; set; }
      public Account Account { get; set; }
      public DateTime Start { get; set; }
      public DateTime? End { get; set; }
  }
  </code></pre>
  
  <p>In reality, there could be multiple <code>Subscription</code> rows for a given account but a business rule dictates that there will only ever be one (or none) with an <code>EndDate</code> of <code>null</code> (the <code>Account</code>'s current subscription). In my model I do not care about the others when I am retrieving an account as I am only after the <em>current</em> one.</p>
  
  <p>How can I tell EF to do this? Playing around with the fluent API doesn't suggest there is anything built in on <code>PropertyBuilder</code> and every example of <code>HasDefaultValueSql</code> I have found has trivial <code>Sql</code> like <code>"GETDATE()"</code> as opposed to something parameterised, which this would need to be (<code>..where AccountId = ?</code>).</p>
  
  <p>So I'm stuck.. any ideas?</p>