Getting Started with Object Mappers
In this chapter, we explore object mapping. As we saw in the previous chapter, working with layers often leads to copying models from one layer to another. Object mappers solve that problem. We first look at manually implementing an object mapper. Then, we improve our design by regrouping the mappers under a mapper service. Finally, we replace that with an open source tool that helps us generate business value instead of writing mapping code.
The following topics are covered in this chapter:
- Overview of object mapping and object mappers
- Implementing a simple object mapper
- Exploring the too-many-dependencies code smell
- Exploring the Aggregate Services pattern
- Implementing a Mapping Façade by leveraging the Façade pattern
- Using the Service Locator pattern to create a flexible Mapping Service in front of our mappers
- Using AutoMapper to map an object to another, replacing our homebrewed code...