Dependency Injection, Services, and Messaging
As we continue building our Recipes! app using .NET MAUI, we want to make the most of the MVVM design pattern. MVVM is great for keeping our code organized and also promotes industry-standard practices that make our code base more maintainable and testable. In this chapter, we will focus on two critical concepts that are central to a solid MVVM architecture: Dependency Injection (DI) and messaging. DI promotes separation of concerns and allows our code to be much more testable. Messaging helps us keep different parts of our code from getting tangled up with each other. It allows different areas of our app to talk to each other in a loosely coupled way. Both concepts are extremely important to ensure that our MVVM architecture truly stands out.
Let’s take a look at what this chapter covers:
- Inversion of Control through Dependency Injection
- Registering, resolving, and injecting services
- Messaging
By the end...