Entity Framework Code First One to One Relationship
I have the following two models public class Account { public int Id { get; set; } public string Name { get; set; } public int CurrentPeriodId { get; set; } [ForeignKey("CurrentPeriodId")] public virtual Period CurrentPeriod { get; set; } public virtual ICollection<Period> Periods { get; set; } } public class Period { public int Id { get; set; } public int AccountId { get; set; } public DateTime StartDate { get; set; } public DateTime EndDate { get; set; } public virtual Account Account { get; set; } } And I am trying to run the following query: from p in context.Periods where p.AccountId ==