Tengo varias Clases que genera el entity framework y se necesitan ser serializadasasi;
string OldVersion = JsonConvert.SerializeObject(foo);
pero me resulta el mensaje :
Self referencing loop detected with type 'System.Data.Entity.DynamicProxies
he consultado y encuentro que se debe tener una clase WebApiConfig que no existe en el proyecto que estoy modificando, y colocar las siguientes lineas de codigo para evitar el error
var jsonFormatter = config.Formatters.OfType<JsonMediaTypeFormatter>().First(); jsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
hay otra forma de agregar esas lineas directamente en el web.config u otra forma para evitar dicho error?
uso Newtonsoft.Json