我遇到了Entity Framework的一个有趣的性能问题.我正在使用Code First.
这是我的实体的结构:
一本书可以有很多评论.评论与单本书相关联.评论可以有一个或多个评论.评论与一篇评论相关联.
public class Book
{
public int BookId { get; set; }
// ...
public ICollection<Review> Reviews { get; set; }
}
public class Review
{
public int ReviewId { get; set; }
public int BookId { get; set; }
public Book Book { get; set; }
public ICollection<Comment> Comments { get; set; }
}
public class Comment
{
public int CommentId { get; set; }
public int ReviewId { get; set; }
public Review Review …Run Code Online (Sandbox Code Playgroud) .net c# entity-framework performance-testing entity-framework-4.1