I have two and more related tables in my project. And need to get related objects.
Here is what I did: http://pastebin.com/BbkT8zvd
And trying to get like this:
using (LocalContext _db = new LocalContext())
{
var list = _db.Document.ToList();
foreach (var item in list)
{
Console.WriteLine(item.Name+ ": ");
foreach (var item2 in item.Comment)
{
Console.WriteLine(item2.CommentText);
}
}
}
It returns no comments related with documents.
Tried Lazy, Eager and Explicit loading methods.
What should I correct in my code?