I'm trying to work out the best method (i.e. most simple and foolproof) for mapping a many-to-many collection that should be sorted when it is retrieved.
Here is the basic entity and table:
public class Person
{
private IList<AddressHistoryRecord> _addressHistory = new List<AddressHistoryRecord>();
IList<AddressHistoryRecord> AddressHistory
{
get { return _addressHistory; }
set { return _addressHistory; }
}
}
public class AddressHistoryRecord
{
public Guid Id { get; set; }
public Guid AtAddressSince { get; set; }
...
}
Tables are:
table t_Person { ... }
table t_PersonAddressHistory { PersonId, AddressHistoryRecordId }
table t_AddressHistoryRecord { Id, AtAddressSince ... }
So I want to be able to have the Person's address history retrieved in sorted order based on the child AddressHistoryRecord table's AtAddressSince column. What's my best option?