Modulight
Modulight is a light modular framework aimed to be low intrusive based on dependency injection for .NET 5, ASP.NET Core and Blazor.
Features
- Dependency injection
- Unified services registering
- CommandLine (cooperated with CliFx)
- Hosting in generic host Microsoft.Extensions.Hosting.IHost
- Dependency injection, logging & hosting services
- Extensible & Composable
- Blazor Client & Server
- Unified CSS & JS lazy loading & prerendering. No need to append
<script>
and<link>
repeatedly for every razor components, especially when use different hosting models. - Unified assembly lazy loading.
- Interop between modules and host.
- A builtin hosting implementation with prerendering.
- Unified CSS & JS lazy loading & prerendering. No need to append
- ASP.NET Server
- Custom middlewares
- Custom endpoints
- GraphQL Server (cooperated with ChilliCream GraphQL Platform)
- Unified query/mutation/subscription definition
- Builtin module dependencies, options & services support
Usage
Use modules
See here for details.
Addition steps
Use Command line modules
See here for details.
Use Razor component modules
See here for details.
Use Blazor UI hosting template
See here for details.
Use ASP.NET modules
See here for details.
Use GraphQL modules
See here for details.
Example codes
They are based on nightly build package at:
Design and use a command line module in console application
Design a client (Blazor) module
- HelloModule.cs Client module definition.
- Index.razor Client module pages. It belongs to a different assembly from which Module belongs to because we want this assembly is lazy loading.
Design a GraphQL server module
- HelloServerModule.cs GraphQL server module definition.
Use a client module in Blazor websites
- ModulePageLayout.razor Layout and container for module pages.
- App.razor Lazy loading for js/css/sassemblies when routing.
- AntDesignModule.cs Definition of JS/CSS resources.
- ModuleSetup.cs Use modules in client.
- Startup.cs Blazor Server hosting.
- Program.cs Blazor WebAssembly hosting.
- index.html Clean index.html.
Use a GraphQL server module
- Startup.cs GraphQL server integrating.
Project guide
- Modulight.Modules.Core Core types for Modulight framework.
- Modulight.Modules.CommandLine Basic types for command line modules.
- Modulight.Modules.Client.RazorComponents Basic types for razor component client modules.
- Modulight.Modules.Server.AspNet Basic types for aspnet server modules.
- Modulight.Modules.Server.GraphQL Basic types for graphql server modules.
-
Hello module A demo module.
- Hello Client module.
- Hello.Core Shared manifest between client & server module.
- Hello.UI UI (pages) for client module.
- Hello.Server Server module.