Routya 4.1.0
dotnet add package Routya --version 4.1.0
NuGet\Install-Package Routya -Version 4.1.0
<PackageReference Include="Routya" Version="4.1.0" />
<PackageVersion Include="Routya" Version="4.1.0" />
<PackageReference Include="Routya" />
paket add Routya --version 4.1.0
#r "nuget: Routya, 4.1.0"
#:package Routya@4.1.0
#addin nuget:?package=Routya&version=4.1.0
#tool nuget:?package=Routya&version=4.1.0
Routya
The all-in-one Routya package — install this and get everything you need.
What's Included
| Package | Description |
|---|---|
| Routya.Core | High-performance CQRS dispatcher — request/response, notifications, pipeline behaviors |
| Routya.SourceGenerators | Compile-time source generator — zero reflection, type-specific dispatch, 55% less memory than MediatR on notifications |
Instead of installing both packages separately, install Routya and both are pulled in automatically, including the source generator.
Installation
dotnet add package Routya
That's it. No second package to remember.
Quick Start
1. Define handlers
using Routya.Core.Abstractions;
public record GetUserRequest(int UserId) : IRequest<User>;
public record User(int Id, string Name);
public class GetUserHandler : IAsyncRequestHandler<GetUserRequest, User>
{
public Task<User> HandleAsync(GetUserRequest request, CancellationToken ct)
=> Task.FromResult(new User(request.UserId, $"User_{request.UserId}"));
}
public class UserCreatedNotification : INotification
{
public int UserId { get; set; }
}
public class EmailHandler : INotificationHandler<UserCreatedNotification>
{
public Task Handle(UserCreatedNotification notification, CancellationToken ct = default)
{
Console.WriteLine($"Sending email for user {notification.UserId}");
return Task.CompletedTask;
}
}
2. Register
using Routya.Generated;
services.AddGeneratedRoutya(); // source generator wires everything up at compile-time
3. Dispatch
var routya = provider.GetRequiredService<IGeneratedRoutya>();
var user = await routya.SendAsync(new GetUserRequest(123));
await routya.PublishAsync(new UserCreatedNotification { UserId = 456 });
Example Projects
See working demos in the GitHub repository:
Source generator path (IGeneratedRoutya)
| Project | Description |
|---|---|
| Routya.WebApi.SourceGen.Demo | ASP.NET Core minimal API — CRUD, pipeline behaviors, notification fan-out, IAsyncEnumerable<T> streaming |
| Routya.WebApi.SourceGen.Demo.Application | The class library holding the handlers for the API above. Shows referenced assembly discovery and [RoutyaHandler] lifetime overrides |
| Routya.SourceGen.Demo | Console app — request/response and notifications, an open-generic request pipeline behavior, and IStreamRequest<T> streaming wrapped in a stream pipeline behavior |
| Routya.SourceGen.DatabaseDemo | Console app — commands and queries against an in-memory SQLite database, with notifications on write |
Runtime dispatch path (IRoutya)
| Project | Description |
|---|---|
| Routya.WebApi.Demo | ASP.NET Core — EF Core with SQL Server, all three handler lifetimes, IStreamRequest<T> streaming straight from the database |
| Routya.Demo | Console app — scoped dispatch, synchronous and asynchronous sends, two stacked pipeline behaviors |
| Routya.Notification.Demo | Console app — PublishAsync and PublishParallelAsync side by side |
| Routya.Demo.NetFramework | .NET Framework 4.8 — confirms Routya.Core runs on the full framework |
Full Documentation
- Routya.Core docs — runtime dispatcher, pipeline behaviors, scoped dispatch, notification strategies
- Routya.SourceGenerators docs — how the source generator works, generated code, performance benchmarks, migration guide
Links
- GitHub: github.com/HBartosch/Routya
- Issues: github.com/HBartosch/Routya/issues
- License: MIT
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Routya.Core (>= 4.1.0)
- Routya.SourceGenerators (>= 4.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
See CHANGELOG.md at https://github.com/HBartosch/Routya/blob/main/CHANGELOG.md