title: What is the best practics of manualy MediaTypeFormatter management at ASP MVC Web API?
body: <p>I have ASP MVC Web API service and my method should return data in specific format (JSON, XML, etc.). Response format depend on method and doesn't depend on client preferences.<br> I use <code>HttpResponseMessage</code> and <code>ObjectContent</code> and I should set MediaTypeFormatter for <code>ObjectContent</code>. <br>
  I can do it this way: </p>
  
  <pre><code>new ObjectContent&lt;MyDataContract&gt;(data, new JsonMediaTypeFormatter())
  </code></pre>
  
  <p>or this way:</p>
  
  <pre><code>new ObjectContent&lt;MyDataContract&gt;(data, Configuration.Formatters.FirstOrDefault(f =&gt; f.GetType() == typeof(JsonMediaTypeFormatter)))
  </code></pre>
  
  <p>None of them look pretty well. <br>
  The first one create new object per each request.<br>
  The second one use searching ant it look inappropriate here.<br>
  Could anybody know better solution for my problem?</p>