Conduit.SourceGenerators
0.1.0
dotnet add package Conduit.SourceGenerators --version 0.1.0
NuGet\Install-Package Conduit.SourceGenerators -Version 0.1.0
<PackageReference Include="Conduit.SourceGenerators" Version="0.1.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="Conduit.SourceGenerators" Version="0.1.0" />
<PackageReference Include="Conduit.SourceGenerators"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add Conduit.SourceGenerators --version 0.1.0
#r "nuget: Conduit.SourceGenerators, 0.1.0"
#:package Conduit.SourceGenerators@0.1.0
#addin nuget:?package=Conduit.SourceGenerators&version=0.1.0
#tool nuget:?package=Conduit.SourceGenerators&version=0.1.0
Conduit
Conduit is a next-generation .NET request pipeline framework — a from-scratch, Native AOT-safe alternative to MediatR built on zero-reflection, source-generator-first architecture.
Define immutable requests, write a single handler, call AddConduit(), and dispatch with ISender.Send. Missing handlers are compile-time errors, not runtime surprises.
Install
dotnet add package Conduit.DependencyInjection
Conduit.DependencyInjection brings in the core runtime packages and the source generator transitively.
Quickstart
using Conduit.Abstractions;
using Conduit.Core;
using Conduit.DependencyInjection;
// 1. Define an immutable request
public sealed record Ping(string Message) : IRequest<string>;
// 2. Implement exactly one handler
public sealed class PingHandler : IRequestHandler<Ping, string>
{
public ValueTask<string> Handle(Ping request, CancellationToken cancellationToken)
=> ValueTask.FromResult($"Pong: {request.Message}");
}
// 3. Register (handlers discovered at compile time — zero reflection)
var services = new ServiceCollection();
services.AddConduit();
await using var sp = services.BuildServiceProvider();
// 4. Dispatch
var sender = sp.GetRequiredService<ISender>();
var result = await sender.Send(new Ping("hello"));
Console.WriteLine(result); // Pong: hello
ASP.NET Core Minimal API
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddConduit();
var app = builder.Build();
app.MapGet("/ping", async (ISender sender, CancellationToken ct) =>
await sender.Send(new Ping("from-api"), ct));
app.Run();
Why Conduit?
- Zero reflection at runtime — dispatch and DI registration are generated
- Native AOT / trim safe by construction
- Compile-time safety — missing or duplicate handlers fail the build (
CONDUIT001/CONDUIT002) - Immutable-by-default requests (
sealed record) - Split
ISender/IPublishercontracts with clear failure semantics
Packages
| Package | Role |
|---|---|
Conduit.Abstractions |
Contracts (IRequest<>, handlers, behaviors, notifications) |
Conduit.Core |
ISender, IPublisher, exceptions |
Conduit.Pipeline |
Delegate-chain pipeline primitives |
Conduit.DependencyInjection |
AddConduit() + generator integration |
Conduit.SourceGenerators |
Incremental generator (analyzer package) |
Conduit.Analyzers |
Roslyn analyzers (missing handler, mutable request, …) |
Conduit.Testing |
FakeSender and test helpers |
Documentation
Full architecture design lives in docs/architecture/. MVP scope and release process are documented under ReleaseProcess/.
License
MIT — see LICENSE.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
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 |
|---|