Diving Deep into Source Generators
We started our journey in this book with an empty folder, within which we went on to create a Blazor WebAssembly application. Then, we added generic services to manipulate data and generic controllers to provide a REST API. Then, in Chapter 5, Building gRPC Services, we integrated the gRPC services that enable our Blazor WebAssembly application to communicate faster between the client and server parts of the application. So, it would not be wrong to say that we have built a functional application. And while it is true, there is always something that we can do better. In this chapter, we will take a look at an option that may speed up our development process: source generators.
As the name implies, source generators can generate source code for our application. In this chapter, we will learn what we can and can’t do with source generators, how to write our generators, and how to consume the generated code. We will also take a look at the...