Reputation: 4657
I have these two models:
public class SystemGroup
{
public Guid ID { get; set; }
public string Name { get; set; }
public virtual SystemGroup ParentGroup { get; set; }
public virtual ICollection<SystemGroup> SubGroups { get; set; }
public virtual ICollection<SystemGroupItem> Items { get; set; }
}
public class SystemGroupItem
{
public Guid ID { get; set; }
public string Name { get; set; }
public SystemGroup Group { get; set; }
public ICollection<Person> AppliedPersons { get; set; }
}
the problem is in this code
YarigaranDbContext context = new YarigaranDbContext();
SystemGroupItem i = context.SystemGroupItems.First();
return View(Items);
i.Group
is null
while I have it in my Database:
I'm using EF version 6
Upvotes: 0
Views: 34