How do I announce the principal end of a 1:1 association in Entity framework using data annotations that are not Primary keys?
public class Event
{
public Guid ID { get; set; }
public DateTime Start { get; set; }
public TimeSpan Duration { get; set; }
public DateTime Stop { get { return Start.Add(Duration); } }
public string Title { get; set; }
public Guid? ScheduleStartID { get; set; }
public Guid? ScheduleCalculatedID { get; set; }
public Guid? SchedAltAddID { get; set; }
public Guid? SchedAltRemoveID { get; set; }
[InverseProperty("StartEvent")]
public virtual Schedule ScheduleStart { get; set; }
[InverseProperty("CalculatedEvents")]
public virtual Schedule ScheduleCalculated { get; set; }
[InverseProperty("AddEvent")]
public virtual ScheduleAlteration SchedAltAdd { get; set; }
[InverseProperty("RemoveEvent")]
public virtual ScheduleAlteration SchedAltRemove { get; set; }
}
public class ScheduleAlteration
{
public Guid ID { get; set; }
public Guid? AddEventID { get; set; }
public Guid? RemoveEventID { get; set; }
public Guid ScheduleID { get; set; }
[InverseProperty("SchedAltAdd")]
public virtual Event AddEvent { get; set; }
[InverseProperty("SchedAltRemove")]
public virtual Event RemoveEvent { get; set; }
public virtual Schedule Schedule { get; set; }
}
I get an error Unable to determine the principal end of an association between the types 'MLNSC.Models.JobEvent' and 'MLNSC.Models.ScheduleAlteration'
How do I specify that the Event is the principle object?