Configuration.ProxyCreationEnabled = false;
Will get null reference exception problem when try to get navigation properties.
Need to do eagerly loading for navigation property by include clause
using (var context = new BloggingContext())
{
// Load all blogs and related posts
var blogs1 = context.Blogs
.Include(b => b.Posts)
.ToList();
}
No comments:
Post a Comment