Senior .NET backend engineer
APIs, event-driven systems, legacy modernisation
C# · .NET · Azure · SQL Server
I'm a senior .NET backend engineer in Lisbon. I've spent more than twelve years building APIs, event-driven services and migrations of old systems onto current .NET, most of it for banks.
This year I'm building open-source projects in public, starting with an event-sourced ledger and a name matcher. When something in them takes more thought than expected, I write it up here.
-
Parking and replaying poison messages in .NET, without the dead-letter queueoutbox-kit
How outbox-kit parks a message the consumer can't handle in the consumer's own database, and replays it once the handler is fixed: DELETE ... OUTPUT deleted.* on SQL Server, DELETE ... RETURNING on PostgreSQL, and the inbox in the same transaction.
-
A RabbitMQ publisher confirm is not enough for a .NET outboxoutbox-kit
How the RabbitMQ transport in outbox-kit decides a send worked: publisher confirms tracked by RabbitMQ.Client 7, mandatory publishing so an unroutable message fails instead of vanishing, a confirm timeout under the relay's claim, and a fresh channel after a broker error.
-
MCP resource subscriptions in ASP.NET Core: key them by session, not by servermcp-kit
Telling an MCP client that an account it attached has changed: the host says what changed, subscriptions live per session, and why keying them by the McpServer a handler receives meant unsubscribe never worked.
-
Integration events in .NET that a consumer can rely onledger-core
Before the ledger publishes anything to Azure Service Bus: a contracts project with no reference to the domain, plain wire types, versions by namespace, and JSON schema snapshots that fail the build when a published shape changes.
-
Auditing and rate limiting MCP tool calls in ASP.NET Coremcp-kit
Part 11 of the series on making an ASP.NET Core API safe for AI agents: one audit record per tool call with a hash of the arguments instead of their values, and a limit per client and tool that the normal rate limiting middleware can't give you.
-
Running the .NET outbox relay on every instance without sending messages twiceoutbox-kit
How outbox-kit lets every instance of a service run the outbox relay: a short claim with a lease instead of a long lock, FOR UPDATE SKIP LOCKED on PostgreSQL, UPDLOCK and READPAST on SQL Server, and the tests that fail when either hint is missing.
-
Making an MCP tool in ASP.NET Core wait for a yes, with no state on the servermcp-kit
Part 9 of the series on making an ASP.NET Core API safe for AI agents: a write tool that answers the first call with a preview and a token, runs only on a second call with the same arguments, and keeps nothing on the server in between.
-
CQRS in .NET without a second databaseledger-core
The read side of ledger-core is three tables in the same SQL Server database as the event store. Why the checkpoint has to sit next to those rows, what keeps the two sides apart, and what compiled EF Core queries took off the reads.
-
MCP tools from an ASP.NET Core API: read-only unless you say otherwisemcp-kit
Part 7 of the series on making an ASP.NET Core API safe for AI agents: why reads and writes get different markers, why a POST marked as a read fails at startup, and why the host has to switch write tools on as well.
-
Idempotency keys in ASP.NET Core that also cover MCP tool callsledger-core
Part 5 of the series on making an ASP.NET Core API safe for AI agents: an Idempotency-Key that runs a POST once and replays the answer, why it had to move from a middleware to an endpoint filter, and how an MCP tool call gets the key to the endpoint.
-
MCP tool schemas from the request types you already havemcp-kit
Part 3 of the series on making an ASP.NET Core API safe for AI agents: building each MCP tool's input schema from the endpoint's body type, route and query parameters with JsonSchemaExporter, and the number handling that makes the schema say string.
-
When an AI agent calls your .NET APImcp-kit
Part 1 of a series on making an ASP.NET Core API safe to call from an AI agent through MCP: the four ways an agent differs from a normal client, and what the next eleven parts build in ledger-core and mcp-kit.
-
One error shape for an ASP.NET Core minimal APIledger-core
Every error from the ledger-core API is now an RFC 9457 problem with a stable code, a traceId, and a status picked from one table. How it's wired in .NET 10 and why some refusals are 409 and others 422.
-
Commands and queries in .NET without MediatRledger-core
ledger-core sends commands and queries through its own dispatcher: about 250 lines, one handler per message, and tracing, logging and validation around every command.
-
Snapshots in an event-sourced ledger are a cacheledger-core
ledger-core takes a snapshot of an account every 100 events. Treating it as a cache decided when it is taken, how it is stored, and what happens when it fails.
-
An event store on PostgreSQL: why appends take a lockledger-core
Identity values are handed out at insert time, not at commit, so a reader that follows the global position can skip an event for good. Here is how my ledger's event store avoids that, and what it costs.
-
Normalising payee names: where NFKD stopspayee-match
NFKD removes most accents from a name before fuzzy matching. It does nothing for ß, ø or ł, so those need a small table, and dots and apostrophes need their own rules.
-
Why 0.05 × 0.5 is 0.02 in my ledgerledger-core
decimal.Round uses banker's rounding by default. How ledger-core uses it, and why amounts with too many decimals are rejected instead of rounded.