The IHostBuilder is at the centre of how modern .NET applications are bootstrapped – it provides a way to register dependencies in the IServiceCollection (DI container), and configures the application with IConfiguration during startup.
Regularly all of this magic happens in the 'Program.cs' and 'Startup.cs' files, and Umbraco exposes the same options through its own IUmbracoBuilder / IComposer concepts. Umbraco splits each of the elements needed to boot into handy, granular extension methods. In its most simplistic form Umbraco calls the following:
- AddUmbraco() – configure logging, hosting environment, and Umbraco Builder
- AddBackOffice() – register core services, and backoffice routes
- AddWebsite() – register core services, and front-end routes
- AddComposers() – load plugin-registered IComposer's
Each of these call further extension methods – e.g. AddUmbracoCore(), AddNuCache(), AddExamine(), AddModelsBuilder(), etc – to configure the application exactly as required. This is particularly helpful in contexts where only some of the out-of-the-box functionality is required, or where a given feature needs to be overridden.