Coding Militia

A .NET parallel Kafka consumer proof of concept (feat. Akka.NET and the actor model)

For some time now, I’ve been thinking about implementing a parallel Kafka consumer proof of concept in C#. I finally got around to it, and this post describes the process.

January 8, 2024 · 19 min · 3954 words · João Antunes

Byte array as a dictionary key? Trying out some options

Using arrays as a dictionary key is not really something very common, but I had the need for it, so did some investigation to try and figure out a good way to do it.

December 6, 2023 · 15 min · 3189 words · João Antunes

Observing .NET microservices with OpenTelemetry - logs, traces and metrics

Observability has been one of the hot topics, with the increasing complexity of knowing what is going on in our applications. Fortunately, .NET has been investing in making things easier with OpenTelemetry.

September 5, 2023 · 27 min · 5619 words · João Antunes

"Parse, don't validate" and other type safety driven shenanigans (plus a C# wishlist)

Making use of the type system is something I feel should be important when working in a strongly typed language like C#. However, I don’t feel like that’s the case, and I would love for the language to push folks in the direction of creating more robust programs, where the compiler provides more help in proving the correctness of the code.

August 17, 2023 · 15 min · 3111 words · João Antunes

Enforce conventions (but don't go overboard) with architecture tests

I’ve been trying to flee the over-engineered C# solution structures, with multiple projects, with related code scattered around. Even if an imperfect solution, I’ve turned to NetArchTest to help in guide on following some conventions in a simplified solution structure.

July 28, 2023 · 7 min · 1394 words · João Antunes

From domain events to infrastructure - thinking out loud about possible approaches I don’t hate

On the topics of domain-driven design and event-driven architecture, something that’s been on my mind for quite some time, is the process of handling domain events, as well as potentially translating them into integration events.

May 16, 2023 · 16 min · 3237 words · João Antunes

Checking out EF Core inheritance options

Recently there was a need to use a hierarchy in a domain model, and there was a question about which of the available approaches to use - table per hierarchy (TPH), table per type (TPT) or table per concrete type (TPC). This very brief post is just a quick look at some benchmarks I created on the subject.

May 8, 2023 · 10 min · 1931 words · João Antunes

A reminder to consider that your context, isn’t the only context (.NET 8 TimeProvider edition)

This will be a very brief post, just as a reminder that we need to give things a good thought, trying to limit our biases (I’ll focus on software development, but it’s applicable to everything really).

April 24, 2023 · 4 min · 653 words · João Antunes

Contract first OpenAPI development (but still use Swagger UI with ASP.NET Core)

In C# and .NET land, we’re pretty heavy on the code first approaches, with the odd exception. Let’s take a look at a possible contract first approach to API development, with OpenAPI, but still taking advantage of existing tooling that we’ve come to rely on, like Swagger UI.

April 2, 2023 · 12 min · 2411 words · João Antunes

Mapping ASP.NET Core minimal API endpoints with C# source generators

I’m pretty late to the C# source generator party, but hey, better late than never 😅. In this post, let’s take a look at how we can automagically map minimal API endpoints using C# source generators

January 31, 2023 · 8 min · 1624 words · João Antunes