I'm using the CTP4 code first EF framework, but I'm having problems getting lazy loading to work. Reading up on it, it should be simple, but it's just not
public class Folder
{
public int Id { get; set; }
public string Name { get; set; }
public int? ParentFolderId { get; set; }
public virtual IList<Folder> ChildFolders { get; set; }
}
In the model configuration:
HasMany(f => f.ChildFolders).WithOptional().HasConstraint((child, folder) => child.ParentFolderId == folder.Id);
However, when I do this:
Folder folder = context.Folders.SingleOrDefault(f => f.Id == 1);
folder.ChildPages is null....but it should be lazy loading it...