I am trying to customise the behaviour of the standard ODataMediaTypeFormatters and have done so by wrapping them in another type which extends MediaTypeFormatter. e.g.
var formatters = ODataMediaTypeFormatters
.Create(serialiserProvider, deserialiserProvider)
.Select(formatter => new Wrapper(formatter));
config.Formatters.InsertRange(0, formatters);
After the WebAPI configuration method has executed config.Formatters contains 12 items (7 of which are the wrapped formatters).
However, when a response is being serialised config.Formatters contains 17 items as the standard OData formatters have been re-added at some point. The relevant standard formatter is then used in preference to the wrapped version.
Does anyone know when this re-addition happens and if/how it can be prevented?