title: Serializing DbCommand with Newtonsoft.Json
body: <p>I am trying to serialize Entity Framework <code>DbCommand</code> to json with <code>Newtonsoft.Json</code>:</p>
  
  <pre><code>public void NonQueryExecuted(DbCommand command, DbCommandInterceptionContext&lt;int&gt; interceptionContext) {
     var path = "C:/result.json";
     File.WriteAllText(path, JsonConvert.SerializeObject(command));
  }
  </code></pre>
  
  <p>However, in result json file the parameters are <code>ToString()</code> values rather than objects:</p>
  
  <pre><code>"Parameters": ["@0", "@1", "@2"]
  </code></pre>
  
  <p>How do I tell the serializer to serialize the whole objects?</p>