How to serialize into a json from entity?

c# entity-framework entity-framework-6 jsonserializer

Accepted Answer

Using anEF issue with dynamic proxy For your code to run, you must disable it.

your class's descendants inDbContext

public class MyModelEntities : DbContext
{
   public MyModelEntities()
   {
      //just disable it like this  
      Configuration.ProxyCreationEnabled = false;
   }
}

Essentially, what's going here is that yourJsonConvert is attempting to serialize this objectSystem.Data.Entity.DynamicProxies.Location_5E43C6C196972BF0754973E48C9C941092D86818CD94005E9A759B70BF6E48E6

due to the proxy, which is dynamically constructed and hence cannot be found

5
11/4/2015 1:09:03 PM

Popular Answer

ZZZ_tmp


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow