I have a problem with Lazy Loading in the Entity Framework. I have some members who check regularly, so the following (simplified) model:
public class Member { public int memberId { get; set; } public string name{ get; set; } } class CheckIn { public int checkInId { get; set; } public virtual Member member { get; set; } public DateTime timestamp { get; set; } }
and in the context of:
public DbSet<Member> leden { get; set; } public DbSet<CheckIn> checkins { get; set; }
So, I checked that the member property is full in the database (it contains memberId).
however, when I try to get all the checks:
IQueryable<CheckIn> Checkins = db.checkins;
it collects all the checks, but everywhere the member property is null. I tried to install
db.Configuration.LazyLoadingEnabled= true;
but it did not help. Anyone with an idea why this is not working?
source share