Inversion of control and its role
Software needs structure really fast when growing beyond one page of source code. Typically, you’d group things logically in types that have a specific purpose in your system. With your software being broken up for better maintainability, the different parts are then often dependent on each other to be able to perform the overall tasks you need it to do.
Building a module for registering users
Let’s build a simple system that handles a user sign-up feature exposed as a REST API. Start by creating a folder called Chapter10. Change into this folder in your command line and create a new web-based project:
dotnet new web
The type of information you’d want to capture involves both personal information and also the user’s credentials that we want to have as part of the body of our API. Add a file called RegisterUser.cs and add the following to it:
namespace Chapter10; public record RegisterUser(string FirstName...