title: How to have an Entity Framework (EF6) dynamic association to latest entry?
body: <p>I have this table/entity scenario in my model-first EF project (simplified):</p>
  
  <pre><code>Machine:
    ID (primary key)
    GroupId (string)
    ActiveConfiguration (of type Configuration)
  
  Configuration:
    ID (primary key)
    GroupId (string)
    ValidFrom (date)
  </code></pre>
  
  <p>Now what I need to achieve is an association such, that <em>Machine.ActiveConfiguration</em> will contain latest configuration of a given <em>GroupId</em>. </p>
  
  <p>Example (data):</p>
  
  <pre><code>Configuration (ID = '1', GroupId = 'A', ValidFrom = '01/01/2017')
  Configuration (ID = '2', GroupId = 'B', ValidFrom = '01/01/2017')
  Configuration (ID = '3', GroupId = 'A', ValidFrom = '01/01/2018')
  </code></pre>
  
  <p>When <em>Machine</em> entity is selected at (for example) <strong>6/30/2017</strong> its <em>ActiveConfiguration</em> property should contain <em>Configuration</em> (ID = '<strong>1</strong>'). When selected at <strong>6/30/2018</strong> it should contain <em>Configuration</em> (ID = '<strong>3</strong>').</p>
  
  <p>Is this possible somehow?</p>