I tried to serialize POCO class that was automatically generated from Entity Data Model .edmx and when I used
JsonConvert.SerializeObject
The simplest way to do this is to install Json.NET
from nuget and add the [JsonIgnore]
attribute to the virtual property in the class, for example:
public string Name { get; set; }
public string Description { get; set; }
public Nullable Project_ID { get; set; }
[JsonIgnore]
public virtual Project Project { get; set; }
Although these days, I create a model with only the properties I want passed through so it's lighter, doesn't include unwanted collections, and I don't lose my changes when I rebuild the generated files...