chapter nine
9 Extension methods, streams, and abstract classes
This chapter covers
- Using Streams to redirect Console output
- Using Abstract classes to provide common functionality across derived classes
- Using the
AddRangeLINQ method to add many things to a collection at once - Using the
SortedListcollection - Using Extension Methods to extend existing types with new functionality
- Refactoring “Magic Numbers”
In section 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, 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 to 8 we implemented (and tested) two repositories out of the four required classes:
CustomerRepository. We implemented this repository class in chapters 6 and 7.BookingRepository.We implemented this repository class in chapter 8.AirportRepository.We implement this repository class in this chapter.FlightRepository.We implement this repository class in this chapter.