CasCap.Common.Services
4.17.0
Prefix Reserved
dotnet add package CasCap.Common.Services --version 4.17.0
NuGet\Install-Package CasCap.Common.Services -Version 4.17.0
<PackageReference Include="CasCap.Common.Services" Version="4.17.0" />
<PackageVersion Include="CasCap.Common.Services" Version="4.17.0" />
<PackageReference Include="CasCap.Common.Services" />
paket add CasCap.Common.Services --version 4.17.0
#r "nuget: CasCap.Common.Services, 4.17.0"
#:package CasCap.Common.Services@4.17.0
#addin nuget:?package=CasCap.Common.Services&version=4.17.0
#tool nuget:?package=CasCap.Common.Services&version=4.17.0
CasCap.Common.Services
Run selected .NET background features by name, observe their lifecycle and expose assembly-backed application metadata.
Installation
dotnet add package CasCap.Common.Services
Target frameworks: net8.0, net9.0, net10.0
Usage
Register implementations as
IBgFeature,
then supply the enabled names to the launcher:
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using CasCap.Common.Abstractions;
using CasCap.Common.Extensions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddSingleton<IBgFeature, WorkerFeature>();
builder.Services.AddFeatureFlagService(
new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "Worker" });
await builder.Build().RunAsync();
public sealed class WorkerFeature(ILogger<WorkerFeature> logger) : IBgFeature
{
public string FeatureName => "Worker";
public async Task ExecuteAsync(CancellationToken cancellationToken)
{
while (!cancellationToken.IsCancellationRequested)
{
logger.LogInformation("Worker is active");
await Task.Delay(TimeSpan.FromMinutes(1), cancellationToken);
}
}
}
Feature matching is case-insensitive. A feature named IBgFeature.AlwaysEnabled ("All") runs
regardless of the selected set. Registration supplies IOptions<FeatureFlagConfig>; it does not
automatically read an EnabledFeatures JSON section.
Service Architecture
- No matching features is a startup failure.
- A child may finish while siblings continue. Faults from enabled children propagate to the host.
- If all children finish before cancellation, the launcher reports an unexpected lifecycle failure.
- A finite job must request
IHostApplicationLifetime.StopApplication()before returning. - Host cancellation cancels and awaits outstanding features, including their cleanup.
- A child fault requests host shutdown immediately, then cancels and awaits its siblings before propagating the failure. Align host and container termination budgets for uncooperative cleanup.
flowchart TD
HOST["Host startup"] --> MATCH["Match registered features against enabled names"]
MATCH --> RUN["Run matching features and All features"]
RUN --> WATCH["Observe child tasks"]
WATCH -->|Child finishes, siblings remain| WATCH
WATCH -->|Child faults or all finish without stopping| FAIL["Request host shutdown, cancel and await siblings, propagate failure"]
WATCH -->|Host cancellation or requested stop| STOP["Cancel and await children, then clean shutdown"]
Configuration Examples
Feature Execution Only
The registration in Usage enables the selected features without periodic metadata logging.
Feature Execution with Metadata
Pass addApplicationMetadataService: true to register ApplicationMetadataBgService and
ApplicationMetadata. The latter reads version, source revision and build context from assembly
attributes, not live Git state.
builder.Services.AddFeatureFlagService(enabledFeatures, addApplicationMetadataService: true);
The optional metadata service binds ApplicationMetadataConfig. Its LogInterval defaults to one
minute and must be positive:
{
"ApplicationMetadataConfig": {
"LogInterval": "00:05:00"
}
}
| 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
- CasCap.Common.Abstractions (>= 4.17.0)
- CasCap.Common.Extensions (>= 4.17.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.13)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.13)
-
net8.0
- CasCap.Common.Abstractions (>= 4.17.0)
- CasCap.Common.Extensions (>= 4.17.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.13)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.13)
-
net9.0
- CasCap.Common.Abstractions (>= 4.17.0)
- CasCap.Common.Extensions (>= 4.17.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.13)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.13)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on CasCap.Common.Services:
| Package | Downloads |
|---|---|
|
CasCap.Api.SignalCli
Typed .NET client for the signal-cli REST API with REST polling and JSON-RPC WebSocket transports, webhook endpoints, health checks, and INotifier integration. |
|
|
CasCap.Common.OpenTelemetry
Reusable OpenTelemetry configuration with standard metrics, traces, and log exporters. |
|
|
CasCap.Api.Voice
Provider-neutral speech-to-text and text-to-speech components for .NET applications. |
|
|
CasCap.Common.Hosting.AspNetCore
ASP.NET Core hosting defaults for feature-gated controllers, Serilog, and OpenTelemetry metrics, traces, and logs. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.17.0 | 165 | 10/24/2026 |
| 4.16.0 | 220 | 10/21/2026 |
| 4.15.0 | 151 | 10/6/2026 |
| 4.14.4 | 254 | 10/4/2026 |
| 4.14.3 | 162 | 9/28/2026 |
| 4.14.2 | 296 | 9/25/2026 |
| 4.14.1 | 361 | 9/23/2026 |
| 4.14.0 | 337 | 9/19/2026 |
| 4.13.0 | 137 | 9/15/2026 |
| 4.12.8 | 160 | 9/10/2026 |
| 4.12.7 | 143 | 9/4/2026 |
| 4.12.6 | 129 | 9/1/2026 |
| 4.12.5 | 141 | 8/20/2026 |
| 4.12.4 | 154 | 8/18/2026 |
| 4.12.3 | 160 | 7/15/2026 |
| 4.12.2 | 170 | 6/26/2026 |
| 4.12.1 | 165 | 6/14/2026 |
| 4.12.0 | 157 | 6/12/2026 |
| 4.11.9 | 160 | 6/10/2026 |
| 4.11.8 | 232 | 5/27/2026 |