KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm getting the error: Object graph for type 'System.Collections.Generic.List`1[[Proj.Model.Prom, Proj.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' contains cycles and cannot be serialized if reference tracking is disabled. Reading about that, seems to be the serializer, but Json.Net claims to be the solution and I've read WebApi and Framework 4.5 has it by default. So Is it coming by default? If so, Why I'm still getting that error? Thanks! Guillermo. EDIT: Adding code using System; using System.Collections.Generic; using System.Data.Spatial; namespace Proj.Model { public class Prom { public Prom() { this.Stores = new List<Store>(); this.Branches = new List<Branch>(); this.Products = new List<Product>(); } public int Id { get; set; } public string Name { get; set; } public DbGeography Location { get; set; } public string Latitude { get; set; } public string Longitude { get; set; } public int StateId { get; set; } public int CategoryId { get; set; } public virtual ICollection<Store> Stores { get; set; } public virtual ICollection<Branch> Branches { get; set; } public virtual ICollection<Product> Products { get; set; } public virtual Category Category { get; set; } public virtual State State { get; set; } } } using System; using System.Collections.Generic; namespace Proj.Model { public class Category { public Category() { this.Proms = new List<Prom>(); } public int Id { get; set; } public string Name { get; set; } public string Description { get; set; } public virtual ICollection<Prom> Proms { get; set; } } } Then running something like this returns the er
Tags (comma-separated)
Save Edits
Cancel