Reputation: 1863
I have an action method which returns a DataRow object. Unfortunately the webapi serializer doesn't serialize the object properly. Is there any place where I can place a custom serialization code just for this particular type ?
Upvotes: 7
Views: 7950
Reputation: 12395
You'll probably want to create a custom MediaTypeFormatter that returns true for DataRow-typed objects in its CanWrite method.
Here's a good starting point for how to write and register your own formatter:
http://www.asp.net/web-api/overview/formats-and-model-binding/media-formatters
Upvotes: 7