title: OData WebApi V4 .net - Custom Serialization
body: <p>I need to create a Serializer to support all of the following tasks:</p>
  
  <ol>
  <li>Removing null properties</li>
  <li>Removing Empty Lists</li>
  </ol>
  
  <p>I noticed the Syntax of the <code>ODataMediaTypeFormatter</code> has been changed.</p>
  
  <p>And I'm having trouble adding my Serialzation provider to the pipe.</p>
  
  <p>Here what I've tried:</p>
  
  <p>On WebApiConfig.cs:</p>
  
  <pre><code>var odataFormatters = ODataMediaTypeFormatters.Create();
  odataFormatters.Add(new MyDataMediaTypeFormatter());
  config.Formatters.InsertRange(0, odataFormatters);
  </code></pre>
  
  <p>Plus I've Created the following <code>Odatameditatypeformatter</code>:</p>
  
  <pre><code>public class MyODataMediaTypeFormatter : ODataMediaTypeFormatter
  {
      static IEnumerable&lt;ODataPayloadKind&gt; payloadKinds = new List&lt;ODataPayloadKind&gt;
      {
  
          ODataPayloadKind.Asynchronous,
          ODataPayloadKind.Batch,
          ODataPayloadKind.BinaryValue,
          ODataPayloadKind.Collection,
          ODataPayloadKind.EntityReferenceLink,
          ODataPayloadKind.EntityReferenceLinks,
          ODataPayloadKind.Error,
          ODataPayloadKind.Delta,
          ODataPayloadKind.IndividualProperty,
          ODataPayloadKind.MetadataDocument,
          ODataPayloadKind.Parameter,
          ODataPayloadKind.Resource,
          ODataPayloadKind.ServiceDocument,
          ODataPayloadKind.Unsupported,
          ODataPayloadKind.Value
      };
  
      public MyODataMediaTypeFormatter() : base(payloadKinds)
      {
      }
  }
  </code></pre>
  
  <p>Currently I checked all the base methods and none of them seems to hit the breakpoint while creating a Get/Post request to my OData controllers.</p>
  
  <p>Any one managed to do it on the new version of Microsoft.Aspnet.OData 7.0.1?</p>