>>In a punch clock application, a given Day has two foreign keys into the Punches table: PunchId_In and PunchId_Out. How can you annotate this relationship so Entity Framework creates it as intended? Note: One or both of these foreign keys may be undefined (null).
>>
>>
>>public class Day
>>{
>> public int DayID { get; set; }
>> public int? PunchId_In { get; set; }
>> public int? PunchId_Out { get; set; }
>> public virtual Punch PunchIn { get; set; }
>> public virtual Punch PunchOut { get; set; }
>>}
>>
>>public class Punch
>>{
>> public int PunchId { get; set; }
>> public DateTime PunchDT { get; set; }
>>}
>>
>
>Add the ForeignKey attribute on your Punch properties to point to the corresponding PunchId. See
https://msdn.microsoft.com/en-us/data/jj591583.aspx#Relationships.
Thanks Rob