Circular Reference error when serializing objects in ASP.NET Web API
问题 I'm writing a Web API project in C# that uses Entity Framework to pull data from a DB, serialize it and send it to a client. My project has 2 classes, Post and Comment (foreign key from Post). These are my classes. Post class: public partial class Post { public Post() { this.Attachment = new HashSet<Attachment>(); this.Comment = new HashSet<Comment>(); } public int PostId { get; set; } public string Title { get; set; } public string Content { get; set; } public System.DateTime Created { get;