D20Tek Mediator supports both synchronous and async commands. In many cases, synchronous commands are plenty. But when working with data files, external service calls, and databases, it is best for performance throughput to build async WebApi handlers and async commands that process that data. To this point, we have mostly looked at synchronous ICommandHandlers. Here … Continue reading Mediator: Sync and Async Commands
Author: DarthPedro
Introducing MinimalApi.DevView – .NET Toolkit for Minimal APIs
Minimal APIs in .NET make it easy to build lightweight web services with minimal ceremony, but during development, visibility into what your app is doing can be a challenge. That’s what MinimalApi.DevView helps you with. Today, I’m excited to announce the release of D20Tek.MinimalApi.DevView v1.0, a dev-time only diagnostics and discovery toolkit designed specifically for … Continue reading Introducing MinimalApi.DevView – .NET Toolkit for Minimal APIs
Ignoring EF Migrations from Code Coverage
I was working unit and functional tests for a project that had a database using EntityFramework. It had multiple migrations that we had applied over time. These migrations are placed as code in our project under a Migrations folder. As I was building and running unit tests, I saw large block of code that we … Continue reading Ignoring EF Migrations from Code Coverage
Simplifying JWT Authentication in Development with ‘dotnet user-jwts’
When developing secure APIs in ASP.NET Core, implementing authentication can often slow down the development cycle, especially when integrating with full-fledged identity providers like Auth0 or Azure AD. Fortunately, starting with .NET 7, Microsoft introduced a powerful CLI tool that streamlines this process: dotnet user-jwts. In this post, we'll explore what dotnet user-jwts is, how … Continue reading Simplifying JWT Authentication in Development with ‘dotnet user-jwts’
Using Code Cleanup Profiles in Visual Studio
In Visual Studio 2022, the Code Cleanup Profiles feature is a great way to automate code formatting and clean-up operations using predefined or custom rules. By using cleanup profiles, you can make all of the changes in one operation and free yourself from updating lots of code files manually. Here's a detailed explanation of how … Continue reading Using Code Cleanup Profiles in Visual Studio
create-guid: Simple CLI Tool for Generating GUIDs
In modern software development, GUIDs (Globally Unique Identifiers) are used everywhere: from identifying database records and correlation tokens to generating unique keys for distributed systems. While System.Guid.NewGuid() is the standard way to generate GUIDs in .NET, there are scenarios where you want a tool that gives you quick and scriptable access to GUIDs from the … Continue reading create-guid: Simple CLI Tool for Generating GUIDs
Using NullLogger and a FakeLogger in Your .NET Tests
While I was working on a .NET WebApi Logging middleware component, I realized that I needed some unit tests to verify that the Logging middleware was actually working as intended. I started down the usual path of installing a mocking library in my test project so that I could mock the logger. But then I … Continue reading Using NullLogger and a FakeLogger in Your .NET Tests
Is ASP.NET WebApi Pipeline Already a Mediator?
As we discussed in earlier posts, the Mediator and Command are patterns that can be implemented in different way. And those patterns already exist in many coding frameworks. As a matter of fact, the ASP.NET WebApi request pipeline can be considered a Mediator and Command implementation, especially when building MinimalApi. Remember that a Mediator encapsulates … Continue reading Is ASP.NET WebApi Pipeline Already a Mediator?
Getting Started with D20Tek.Mediator Package
There are a few Mediator and Command implementations in the .NET ecosystem. The most popular one has been Mediatr. But with the recent announcement that Mediatr is moving to a commercial license, many developers looking for alternatives. In an attempt to support the .NET community, I am building a simplified Mediator and Command library that … Continue reading Getting Started with D20Tek.Mediator Package
Using the with Expression on Classes
Just today I learned that the with expression in C# is not limited to records. It can also be used with classes, as long as the class is defined with the with expression requirements. And what are the requirements to work with the with expression? Requirements for with expressions to work: The type must be … Continue reading Using the with Expression on Classes