CShells 0.0.11
dotnet add package CShells --version 0.0.11
NuGet\Install-Package CShells -Version 0.0.11
<PackageReference Include="CShells" Version="0.0.11" />
<PackageVersion Include="CShells" Version="0.0.11" />
<PackageReference Include="CShells" />
paket add CShells --version 0.0.11
#r "nuget: CShells, 0.0.11"
#:package CShells@0.0.11
#addin nuget:?package=CShells&version=0.0.11
#tool nuget:?package=CShells&version=0.0.11
CShells
A modular multi-tenancy framework for .NET that enables building feature-based applications with isolated services, configuration, and background workers.
Purpose
CShells is the core runtime package that provides shell hosting, feature discovery, dependency injection container management, and configuration-driven multi-tenancy.
Key Features
- Multi-shell architecture - Each shell has its own isolated DI container
- Feature-based modularity - Features are discovered automatically via attributes
- Dependency resolution - Features can depend on other features with topological ordering
- Configuration-driven - Shells and their features are configured via appsettings.json or code
- Background worker support - Execute work in shell contexts via
IShellContextScopeFactory - Runtime shell management - Add, update, or remove shells at runtime
Installation
dotnet add package CShells
Quick Start
1. Create a Feature
using CShells.Features;
using Microsoft.Extensions.DependencyInjection;
[ShellFeature("Core", DisplayName = "Core Services")]
public class CoreFeature : IShellFeature
{
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<ITimeService, TimeService>();
}
}
2. Configure Shells
{
"CShells": {
"Shells": [
{
"Name": "Default",
"Features": [ "Core" ]
}
]
}
}
3. Register CShells
var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddCShells();
var app = builder.Build();
app.Run();
Shell Context Scopes & Background Work
Use IShellContextScopeFactory to create scoped services within a shell's service provider:
public class ShellBackgroundWorker : BackgroundService
{
private readonly IShellHost _shellHost;
private readonly IShellContextScopeFactory _scopeFactory;
public ShellBackgroundWorker(
IShellHost shellHost,
IShellContextScopeFactory scopeFactory)
{
_shellHost = shellHost;
_scopeFactory = scopeFactory;
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
while (!stoppingToken.IsCancellationRequested)
{
foreach (var shell in _shellHost.AllShells)
{
using var scope = _scopeFactory.CreateScope(shell);
var service = scope.ServiceProvider.GetService<IMyService>();
service?.Execute();
}
await Task.Delay(TimeSpan.FromSeconds(30), stoppingToken);
}
}
}
Configuration Options
Code-first Configuration
builder.Services.AddCShells(cshells =>
{
cshells.AddShell("Default", shell => shell
.WithFeatures("Core", "Weather")
.WithConfiguration("Theme", "Dark")
.WithConfiguration("MaxItems", "100"));
});
Custom Shell Settings Provider
public class DatabaseShellSettingsProvider : IShellSettingsProvider
{
public async Task<IEnumerable<ShellSettings>> GetAllAsync()
{
// Load from database, API, etc.
return Enumerable.Empty<ShellSettings>();
}
}
builder.Services.AddCShells(cshells =>
{
cshells.WithProvider<DatabaseShellSettingsProvider>();
});
Learn More
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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
- CShells.Abstractions (>= 0.0.11)
- JetBrains.Annotations (>= 2025.2.4)
- Microsoft.Extensions.Configuration (>= 10.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.DependencyModel (>= 10.0.1)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Logging (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
-
net8.0
- CShells.Abstractions (>= 0.0.11)
- JetBrains.Annotations (>= 2025.2.4)
- Microsoft.Extensions.Configuration (>= 9.0.11)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.11)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.11)
- Microsoft.Extensions.DependencyInjection (>= 9.0.11)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.11)
- Microsoft.Extensions.DependencyModel (>= 10.0.1)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.11)
- Microsoft.Extensions.Logging (>= 9.0.11)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.11)
-
net9.0
- CShells.Abstractions (>= 0.0.11)
- JetBrains.Annotations (>= 2025.2.4)
- Microsoft.Extensions.Configuration (>= 9.0.11)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.11)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.11)
- Microsoft.Extensions.DependencyInjection (>= 9.0.11)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.11)
- Microsoft.Extensions.DependencyModel (>= 10.0.1)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.11)
- Microsoft.Extensions.Logging (>= 9.0.11)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.11)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on CShells:
| Package | Downloads |
|---|---|
|
CShells.AspNetCore
ASP.NET Core integration for CShells. Provides middleware and extensions for shell/tenant resolution based on HTTP context, including host-based and route-based strategies for modular multi-tenant applications. |
|
|
CShells.Providers.FluentStorage
FluentStorage integration provider for CShells. Enables loading and persisting shell configurations from various storage backends (Azure Blob, AWS S3, disk, memory, etc.) supported by FluentStorage. |
GitHub repositories
This package is not used by any popular GitHub repositories.