This chapter covers
- Using streams to redirect console output
- Using abstract classes to provide common functionality across derived classes
- Using the AddRange LINQ method to add many things to a collection at once
- Using the SortedList collection
- Using extension methods to extend existing types with new functionality
- Refactoring “magic numbers”
In sections 3.1 and 3.2, the CEO of Flying Dutchman Airlines tasked us with creating a new version of the existing FlyingDutchmanAirlines codebase. The existing codebase is old and riddled with design flaws, and does not play nice with the new API requirements put in place by a newly signed business deal with a search aggregator. In chapters 3 and 4, we considered the existing codebase and earmarked potential improvements. In chapter 5, we started our refactor and implemented a database access layer with Entity Framework Core. Following that, in chapters 5 through 8 we implemented (and tested) two repositories out of the following four required classes: