title: Detach EF object from databasecontext to avoid circular reference
body: <p>Based on Wes Grants answer in this thread: <a href="https://stackoverflow.com/questions/4053161/serializing-entity-framework-problems">Serializing Entity Framework problems</a></p>
  
  <p>I tried the following code:</p>
  
  <pre><code>string sid = HttpContext.Current.Request["Sid"];
  SYSTEM system = context.SYSTEM.Where(s =&gt; s.SYSTEM_ID.Contains(sid)).First();
  
  context.Detach(system);
  
  HttpContext.Current.Response.Write(serializer.Serialize(system));
  </code></pre>
  
  <p>But I still get the circular reference exception. Did I miss something obvious here? Thanks</p>