Modulight is a light modular framework aimed to be low intrusive based on dependency injection for .NET, ASP.NET, Blazor, and command-line.
- Register modules.
For general modules:
services.AddModules(builder => {
builder.AddModule<FooModule>();
});
- Configure the module initilizing & shutdown.
var host = services.GetModuleHost();
await host.Initialize();
// do something
await host.Shutdown();
// Or use context:
// context: IServiceProvider services (provided by package Modulight.Modules.Core)
await using var _ = await services.UseModuleHost();
// do something
Or use extension methods for hosting:
// Generic hosting. (provided by package Modulight.Modules.Hosting)
// in Program: Task Main(string[] args)
await CreateHostBuilder(args).Build().RunAsyncWithModules();
// WebAssembly hosting. (provided by package Modulight.Modules.Client.RazorComponents)
// in Program: Task Main(string[] args)
await builder.Build().RunAsyncWithModules();