I am trying to load a navigation property through Code First and EF 5.0 The child object is loading as null. below is the code.
[Table("ls_roles")] public class Role { [Required] [Key] public int RoleID { get; set; } [Required] public String BarColor { get; set; } [ForeignKey("RoleId")] public virtual ICollection<ScheduleEmployee> Employees { get; set; } } [Table("ls_ScheduleEmployee")] public class ScheduleEmployee { [Key] [Required] public int Id { get; set; } [Required] public int RoleId { get; set; } [ForeignKey("RoleId")] public Role Role { get; set; } } EDIT: CALLING CODE
class Program { static void Main(string[] args) { var x = new Model.ContextEntityFramework().ScheduleEmployees.FirstOrDefault(); } } x.Role == null at this point
RoleorEmployees