CHAPTER 12
Creating Media Type Formatters
Media type formatters are the component responsible for serializing model data so that it can be sent to the client. In this chapter, I explain how media type formatters work by creating a custom data format and using it to explain the different ways in which a formatter can be applied. Table 12-1 summarizes this chapter.
Table 12-1. Chapter Summary
Problem | Solution | Listing |
---|---|---|
Create a media type formatter. | Derive from the MediaTypeFormatter class and implement the CanReadType, CanWriteType, and WriteToStreamAsync methods. | 1–3 |
Register a media type formatter. | Add an instance of the custom class to the formatter ... |
Get Expert ASP.NET Web API 2 for MVC Developers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.