I have Backpack and Book entities. Book references Backpack (one to many). I am creating an instance of Backpack and bunch of Books. So in this case backpack has bunch of books. I am saving those entities to the db. I am verifying that those got saved to the db. When I try to load backpack it loads fine and all the properties are set except the navigation properties. I am also checking that LazyLoading is not disabled. My navigation properties has the virtual keyword. I am not sure what I am doing wrong. If I try to Load the backpack with Include() it loads the books:
dbContext.Backpacks.Where(b=>b.Name!="").Include("Books").FirstOrDefault()
I am trying to figure out why it is not loading the books lazily? I have the same problem with loading the book. When I load the book, it doesn't have the backpack attached. I see that the BackpackId is there.
In my property getter/setter I have some logic that will be fired, but I am not sure how that could be a problem.