August 2014
Intermediate to advanced
688 pages
18h 5m
English
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 ... |