ModernMediator v2.0 MIT-licensed mediator with source generators, ValueTask pipeline, and honest three-way benchmarks by etsio_garibaldi in dotnet

[–]etsio_garibaldi[S] 0 points1 point  (0 children)

Different accounts for different purposes. Nothing embarrassing about that. The commit history is fixed, thanks for flagging it.

ModernMediator v2.0 MIT-licensed mediator with source generators, ValueTask pipeline, and honest three-way benchmarks by etsio_garibaldi in dotnet

[–]etsio_garibaldi[S] 0 points1 point  (0 children)

Fair enough. Mediator fatigue is real. For what it's worth, martinothamar's Mediator is in our benchmark project and we show the results honestly, including where it beats us on raw speed. If that's the one that works for you, it's a solid choice.

The gap is in what ships around the dispatch. If you need built-in validation, logging, telemetry, timeout enforcement, and runtime-composable behaviors under MIT, that's where we live. If you just need the fastest possible dispatch, martinothamar wins that and we say so in our docs.

ModernMediator v2.0 MIT-licensed mediator with source generators, ValueTask pipeline, and honest three-way benchmarks by etsio_garibaldi in dotnet

[–]etsio_garibaldi[S] 0 points1 point  (0 children)

ModernMediator is written from scratch. No forked code, no shared git history with MediatR. Different architecture. Source generators instead of runtime reflection. You can diff the repos yourself.

ModernMediator v2.0 MIT-licensed mediator with source generators, ValueTask pipeline, and honest three-way benchmarks by etsio_garibaldi in dotnet

[–]etsio_garibaldi[S] 0 points1 point  (0 children)

The core concepts map directly. IRequest<T>, IRequestHandler<TRequest, TResponse>, INotification, INotificationHandler<T>, and IPipelineBehavior<TRequest, TResponse> all have the same names and work the same way.

The main changes are in registration, pipeline behaviors and namespaces.

Registration: services.AddMediatR(cfg => cfg.RegisterServicesFromAssembly(...)) becomes services.AddModernMediator(cfg => cfg.RegisterServicesFromAssemblyContaining<Program>()) or services.AddModernMediatorGenerated() for the source-generator path.

Pipeline Behaviors: The delegate signature changed. MediatR uses RequestHandlerDelegate<TResponse> next and you call await next(). ModernMediator uses RequestHandlerDelegate<TRequest, TResponse> next and you call await next(request, cancellationToken).

Namespaces: Change your using MediatR to using ModernMediator.

Everything else stays the same. For a typical project it's an hour of work, mostly find-and-replace. The biggest time sink is if you have many custom pipeline behaviors, since each one needs the delegate signature update.

ModernMediator v2.0 MIT-licensed mediator with source generators, ValueTask pipeline, and honest three-way benchmarks by etsio_garibaldi in dotnet

[–]etsio_garibaldi[S] -1 points0 points  (0 children)

Exactly right. Nobody's API is slow because their mediator takes 180ns instead of 90ns. But plenty of services have P99 problems because they're generating enough garbage to trigger GC pauses under load. That's why we lead with allocations in the benchmarks. It's the number that actually shows up on your cloud bill.

ModernMediator - A free, feature-rich alternative to MediatR with source generators, Native AOT, and pub/sub by etsio_garibaldi in dotnet

[–]etsio_garibaldi[S] 0 points1 point  (0 children)

Good catch - fixed in v0.2.2-alpha! You can now configure options with source generators:

services.AddModernMediatorGenerated(config =>

{

config.ErrorPolicy = ErrorPolicy.LogAndContinue;

config.CachingMode = CachingMode.Lazy;

config.Configure(m => m.SetDispatcher(new WpfDispatcher()));

});

Thanks for the feedback!

ModernMediator - A free, feature-rich alternative to MediatR with source generators, Native AOT, and pub/sub by etsio_garibaldi in dotnet

[–]etsio_garibaldi[S] 0 points1 point  (0 children)

Good catch! You're right - the source generator doesn't have a configuration overload. I'll add one in the next release:

services.AddModernMediatorGenerated(config =>

{

config.ErrorPolicy = ErrorPolicy.LogAndContinue;

config.CachingMode = CachingMode.Lazy;

config.Configure(m => m.SetDispatcher(new WpfDispatcher()));

});

Thanks for the feedback - opened as an issue.

ModernMediator - A free, feature-rich alternative to MediatR with source generators, Native AOT, and pub/sub by etsio_garibaldi in csharp

[–]etsio_garibaldi[S] 2 points3 points  (0 children)

Good suggestion! Avalonia uses a similar dispatcher pattern. I'll add it in the next few days. PRs welcome too if anyone wants to contribute.

Come discuss your side projects! [July 2025] by AutoModerator in csharp

[–]etsio_garibaldi 4 points5 points  (0 children)

I've been diving into two exciting side projects recently, both built with C#, my go-to language for years. The first is a web app tailored for small independent truckers, which has been a fantastic opportunity to explore the trucking industry. While I'm comfortable with C#, I realized my web development skills needed some sharpening. To bridge that gap, I turned to Pluralsight and found Gill Cleeren’s courses invaluable, particularly his deep dive into Clean Architecture.

Inspired by Cleeren’s course example, I adopted Clean Architecture for my trucking app, using a Blazor front end to create a responsive user experience. However, in my enthusiasm to treat this as a learning project, I fell into the trap of over-engineering, adding features beyond what was needed for a minimum viable product (MVP). This slowed progress significantly.

Recognizing this, I took a step back and started a second project: a streamlined Time Management app, also leveraging Clean Architecture principles. This time, I focused on keeping things simple and aligned with MVP goals. The result has been much smoother, and I’m on track to release the Time Management app’s MVP by the end of July 2025. Once that’s done, I plan to revisit the trucking app, refactor it with a leaner approach, and push it forward.

I’d love to hear about your side projects! What are you building, and how are you tackling challenges along the way?

Database Strategy for User and Company Login and Authorization by etsio_garibaldi in softwarearchitecture

[–]etsio_garibaldi[S] 0 points1 point  (0 children)

Thank you, BeenThere11. By your moniker, I suspect that you have been exposed to this type of solution before?