I have this table/entity scenario in my model-first EF project (simplified):
Machine:
ID (primary key)
GroupId (string)
ActiveConfiguration (of type Configuration)
Configuration:
ID (primary key)
GroupId (string)
ValidFrom (date)
Now what I need to achieve is an association such, that Machine.ActiveConfiguration will contain latest configuration of a given GroupId.
Example (data):
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')
When Machine entity is selected at (for example) 6/30/2017 its ActiveConfiguration property should contain Configuration (ID = '1'). When selected at 6/30/2018 it should contain Configuration (ID = '3').
Is this possible somehow?