AutoMapper and MediatR Roadmaps
One of my main goals of commercialization of AutoMapper and MediatR was being able to finally invest time in these projects where basically all new work stopped when I lost corporate sponsorship. I wanted to take some time to share where I'd like to take these projects now that I have that sponsorship back.
Tracking official .NET support
Firstly, the latest releases bring back netstandard2.0
support for both AutoMapper and MediatR which had dropped both years ago. MediatR was actually still on net6.0
prior to this release which was already out of support for months.
It wasn't exactly easy, especially because of how much net8.0
and net9.0
have diverged from netstandard2.0
not just in terms of APIs but C# language features, but having been part of several ASP.NET 4.x to ASP.NET Core migrations, having netstandard2.0
support makes this transition quite a bit easier. In the past we'd have to conditionally reference packages because there was no longer a common package version between say .NET 8 and .NET 4.8. That's something that I wish I had before that now I do.
AutoMapper Roadmap
One of the biggest complaints I hear about AutoMapper is that it's hard to debug - you're trading compile-time errors for runtime exceptions. We spent a LOT of time baking in better exception handling into the expression trees generated (resulting in worse performance, but better diagnostics), but that isn't always enough.
The answer here is source generators, but I'm not interested in merely copying other library's approaches. What I want to target is source generators that:
- Plug in to AutoMapper's rich extensibility model
- Stay true to AutoMapper's design philosophy
- Support IQueryables (my favorite feature)
- Track the features of AutoMapper's in-memory mapping
- Support mapping validation (critical for any mapping tool)
Debuggability is my main focus here, although obviously performance would be a secondary win. Source generators have come a LONG way since I first looked at them when they were first released, so I'm excited to extend AutoMapper's functionality in this area.
This one is pretty big, so that's going to be my focus initially.
MediatR Roadmap
Some folks have asked or even pointed to other libraries that do source generation of basically a copy of MediatR's API. I am looking at that, but there's been quite a few things on MediatR's backlog that I want to look at first. Source generation in mediators I find a bit less interesting in real-world projects, outside of philosophical debates.
MediatR is commonly used in concert with Vertical Slice Architecture, and a number of its features came out of using it in these scenarios (like behaviors). Today, a lot of features are tied in to the feature set of the stock Microsoft DI container. Unfortunately, features are only really added to that container if the ASP.NET Core team needs them. Even my PR to support generic constraints took like 5 years to merge in.
Moving away from relying on those DI features would mean I could do much more interesting things in the "application use case pipeline" that aren't possible with C#/DI alone, like:
- Applying behaviors based on customized policies
- Baking in support for result patterns
- Direct support for application use cases
- Blazor (sending a request from the client to a handler on the server)
- Minimal APIs (scaffolding to separate API logic from application logic)
- Domain events via notifications and EF/other ORMs
The idea of behaviors came from reviewing many production systems using MediatR and folding in that into first-class features. I am going to continue on this track.
What else are you interested in?