If I generate entites in the edmx from the DB, the attributes each Navigation Property gets automatically are:
that means that soap and xml serialization will not serialize them, and it's good for my case.
But when I use JSON.NET it looks for JsonIgnoreAttribute which not created automatically, and therefor it serialize them.
What I did in order to not change the edmx file and add there JsonIgnoreAttribute (because each change in the designer will delete those changes),
is go to DefaultContractResolver.cs and change:
bool hasJsonIgnoreAttribute = JsonTypeReflector.GetAttribute<JsonIgnoreAttribute>(attributeProvider) != null
bool hasJsonIgnoreAttribute = JsonTypeReflector.GetAttribute<XmlIgnoreAttribute>(attributeProvider) != null
so json.net will serialize according to the xml ignore attributes.
Is there other way to do it than change the source code of json.net?