-
Notifications
You must be signed in to change notification settings - Fork 65
Host Process
The MODiX "Host Process" component is the "glue" of the MODiX Application. It's responsible for controlling assembly and configuration of the various services and components that make up the application as a whole. It is, essentially, the entry-point of the application.
- Define the entry point of the application
- Configure the Dependency Injection container
- Configure and host application services and components
- Configure and host development and design tools
The "Host Process" should not be concerned with configuring all services and components directly. Rather, It should invoke high-level methods for different modules of the application, allowing modules to configure themselves and the services and components they define. This helps reduce visual clutter. E.G.
public static IServiceCollection AddModixPromotions(this IServiceCollection services)
=> services
.AddScoped<IPromotionsService, PromotionsService>()
.AddScoped<IPromotionActionRepository, PromotionActionRepository>()
.AddScoped<IPromotionCampaignRepository, PromotionCampaignRepository>()
.AddScoped<IPromotionCommentRepository, PromotionCommentRepository>();
Fluent syntax should be used whenever feasible, to highlight the intended declarative nature of application configuration. E.G.
services
.AddModixCore()
.AddModixMessaging()
.AddModixModeration()
.AddModixPromotions()
.AddCodePaste()
.AddCommandHelp()
.AddGuildStats()
.AddModixTags()
.AddStarboard()
.AddAutoRemoveMessage()
.AddEmojiStats()
.AddImages()
.AddGiveaways();
If you encounter anything confusing about the MODiX codebase, have a look at Application Architecture, or just hop into #modix-development and ask us directly.