MagicCSharp.App 1.0.2

dotnet add package MagicCSharp.App --version 1.0.2
                    
NuGet\Install-Package MagicCSharp.App -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MagicCSharp.App" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MagicCSharp.App" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="MagicCSharp.App" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MagicCSharp.App --version 1.0.2
                    
#r "nuget: MagicCSharp.App, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MagicCSharp.App@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MagicCSharp.App&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=MagicCSharp.App&version=1.0.2
                    
Install as a Cake Tool

MagicCSharp.App

Everything a MagicCSharp web service needs, in two calls. Add it when you are starting a web service and want the framework's defaults without choosing each piece; the day you need to choose, replace it with the calls it stands for.

var builder = WebApplication.CreateBuilder(args);
builder.AddMagicApp();

var app = builder.Build();
app.UseMagicApp(builder);
app.Run();

AddMagicApp registers use cases and their dependencies, TimeProvider, Snowflake ids, request-id tracking, in-process events, single-machine scheduling defaults, problem-details error handling, controllers and the JSON conventions the framework's own types need. UseMagicApp resolves every registration once — so a miswired dependency fails the deploy rather than the first request — then builds the pipeline in the order those pieces need: request id, error handling, controllers.

What it brings in

MagicCSharp, MagicCSharp.AspNetCore, MagicCSharp.Events, MagicCSharp.Scheduling.

This is a shortcut, not a layer. Every call it makes is public on the package that owns it, so outgrowing the defaults means replacing this with the five lines it stands for — not working around it.

Use the individual packages when you want to choose each piece, and for anything that is not a web service: a worker, a console app, a test project. A project that only needs use cases should reference MagicCSharp, not this.

Changing the defaults

builder.AddMagicApp(new MagicAppOptions
{
    ShouldMapControllers = false,        // minimal APIs
    ShouldRegisterScheduling = false,    // more than one instance — register your own store and lock provider
    KeyGeneratorId = 3,                  // stable per instance, rather than random
});
Option Default
ShouldRegisterEvents on Handler discovery, plus in-process dispatch unless something already claimed IEventDispatcher
ShouldUseOpenTelemetryMetrics off Event metrics through OpenTelemetry rather than discarded
ShouldRegisterScheduling on The single-machine schedule store and file-system lock
LockDirectory temp Where the file lock provider writes
ShouldHandleErrors on Exceptions to RFC 7807 responses
ShouldMapControllers on AddControllers and MapControllers
ShouldApplyJsonConventions on Enums as their names and Optional<T> round-tripping, for controllers and minimal APIs alike
ShouldRunPreflight on Resolve every registration at startup — needs the builder passed to UseMagicApp
KeyGeneratorId random Snowflake generator id, 0–1023
AssemblyFilter non-framework Which assemblies are scanned for use cases and handlers

Pass the same options to both calls.

Kafka or SQS instead of in-process events

Register the transport before AddMagicApp, and it is left alone:

builder.Services.AddMagicKafkaEvents(kafkaConfig);
builder.AddMagicApp();

Same for scheduling: register your own IScheduleStore and IDistributedLockProvider first and the single-machine defaults step aside.

The packages behind it

The whole picture, and the optional repository layout: github.com/MagicDoorInc/MagicCSharp. MIT.

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 325 9/24/2026
1.0.1 88 9/24/2026
1.0.0 86 9/23/2026