AuroraScienceHub.Framework.Composition
10.0.5
Prefix Reserved
dotnet add package AuroraScienceHub.Framework.Composition --version 10.0.5
NuGet\Install-Package AuroraScienceHub.Framework.Composition -Version 10.0.5
<PackageReference Include="AuroraScienceHub.Framework.Composition" Version="10.0.5" />
<PackageVersion Include="AuroraScienceHub.Framework.Composition" Version="10.0.5" />
<PackageReference Include="AuroraScienceHub.Framework.Composition" />
paket add AuroraScienceHub.Framework.Composition --version 10.0.5
#r "nuget: AuroraScienceHub.Framework.Composition, 10.0.5"
#:package AuroraScienceHub.Framework.Composition@10.0.5
#addin nuget:?package=AuroraScienceHub.Framework.Composition&version=10.0.5
#tool nuget:?package=AuroraScienceHub.Framework.Composition&version=10.0.5
AuroraScienceHub.Framework.Composition
A modular composition framework for .NET applications that provides structured service organization using application modules and service modules.
Overview
Build applications using a modular architecture pattern. Organize dependency injection registration into logical, reusable modules that ensure services are registered only once.
Key Features
- Modular Architecture - Organize services into logical, reusable modules
- Single Registration Guarantee - Ensures each module's services are registered only once
- Assembly Discovery - Automatically tracks assemblies associated with modules
- Configuration Support - Built-in IConfiguration integration
- Extension Methods - Helpful utilities for service registration
Installation
dotnet add package AuroraScienceHub.Framework.Composition
Architecture
The composition framework uses a hierarchical structure where Application Modules aggregate multiple Service Modules. Each Service Module encapsulates a cohesive set of service registrations and is guaranteed to be registered only once, preventing duplicate dependencies.
graph TD
App[Your Application]
AppModule[ApplicationModule]
SM1[ServiceModule 1<br/>Database]
SM2[ServiceModule 2<br/>Caching]
SM3[ServiceModule 3<br/>Messaging]
Services[IServiceCollection]
App -->|Creates & Configures| AppModule
AppModule -->|Contains| SM1
AppModule -->|Contains| SM2
AppModule -->|Contains| SM3
SM1 -->|Registers Services| Services
SM2 -->|Registers Services| Services
SM3 -->|Registers Services| Services
style App fill:none,stroke:none
style AppModule fill:none,stroke:none
style SM1 fill:none,stroke:none
style SM2 fill:none,stroke:none
style SM3 fill:none,stroke:none
style Services fill:none,stroke:none
Key Concepts:
- ApplicationModule - Top-level module that composes multiple service modules and represents a complete application or subsystem
- ServiceModule - Self-contained unit that registers a cohesive set of related services (e.g., database, caching, messaging)
- Single Registration - Each service module maintains internal state to ensure its services are registered exactly once, even if referenced by multiple application modules
Usage
Create a Service Module
public class DatabaseServiceModule : ServiceModuleBase
{
protected override void ConfigureServicesInternal(
IServiceCollection services,
IConfiguration configuration)
{
services.AddDbContext<MyDbContext>();
services.AddScoped<IRepository, Repository>();
}
}
Create an Application Module
public class MyApplicationModule : ApplicationModuleBase
{
public MyApplicationModule()
: base("MyApp", new ServiceModuleBase[]
{
new DatabaseServiceModule(),
new CachingServiceModule()
})
{
}
}
Register in Your Application
var builder = WebApplication.CreateBuilder(args);
var module = new MyApplicationModule();
module.ConfigureServices(builder.Services, builder.Configuration);
Helper Extensions
// Register class with all implemented interfaces
services.AddScopedAsImplementedInterfaces<MyService>();
// Check if service is registered
if (services.ContainsService<IMyService>()) { }
Module Options
public class MyModuleOptions : ApplicationModuleOptionsBase
{
public string ConnectionString { get; set; }
}
// appsettings.json
{
"Modules": {
"MyModule": {
"ConnectionString": "...",
"EnableConsumers": true
}
}
}
Benefits
- Maintainability - Clear separation of concerns
- Reusability - Service modules can be shared across applications
- Testability - Easy to mock and test individual modules
- Prevention of Duplicate Registration - Built-in marker pattern
Integration with ASP.NET Core
For web applications, see AuroraScienceHub.Framework.AspNetCore which extends this package with IWebApplicationModule and WebApplicationModuleBase.
License
See LICENSE file in the repository root.
Related Packages
AuroraScienceHub.Framework.AspNetCore- ASP.NET Core extensionsAuroraScienceHub.Framework.Configuration- Enhanced configuration support
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.7)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.7)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on AuroraScienceHub.Framework.Composition:
| Package | Downloads |
|---|---|
|
AuroraScienceHub.Framework.AspNetCore
ASP.NET Core extensions for composition, diagnostics, problem details (RFC 7807), security utilities, and routing enhancements. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.0.5 | 102 | 4/23/2026 |
| 10.0.4 | 116 | 4/23/2026 |
| 10.0.3 | 128 | 2/11/2026 |
| 10.0.2 | 118 | 1/29/2026 |
| 10.0.1 | 241 | 12/25/2025 |
| 10.0.0 | 448 | 12/11/2025 |
| 9.0.7 | 453 | 11/20/2025 |
| 9.0.6 | 203 | 11/15/2025 |
| 9.0.5 | 159 | 11/8/2025 |
| 9.0.4 | 172 | 10/24/2025 |
| 9.0.3 | 230 | 10/15/2025 |
| 9.0.2 | 215 | 10/15/2025 |
| 9.0.1 | 224 | 10/14/2025 |
| 9.0.1-workflow-test-2.17 | 150 | 10/14/2025 |