Generated by Rank Math SEO, this is an llms.txt file designed to help LLMs better understand and index this website. # Asad Ali ## Sitemaps [XML Sitemap](https://asadali.dev/sitemap_index.xml): Includes all crawlable and indexable pages. ## Posts - [The Five Signs Your C Sharp Codebase Is About to Become Legacy](https://asadali.dev/blog/the-five-signs-your-c-sharp-codebase-is-about-to-become-legacy/): Legacy code is rarely old. I have seen brand new services become legacy within a year because the foundations were weak. Legacy is not about age. It is about friction. It is about how expensive it becomes to make even the smallest change. Over the years I have learned to spot the early signals long before a system collapses under its own weight. - [The Hidden Async Await Traps in C# That Even Experienced Developers Miss](https://asadali.dev/blog/the-hidden-async-await-traps-in-c-that-even-experienced-developers-miss/): Async can make or break a system. I have seen beautifully designed architectures fall apart in production because a single async misuse silently caused deadlocks, thread starvation, or cascading latency. After building and operating distributed systems for years, these are the async traps that consistently hurt experienced teams the most. - [Five Dangerous C# Sharp Anti Patterns That Will Hurt You in Production](https://asadali.dev/blog/five-dangerous-c-sharp-anti-patterns-that-will-hurt-you-in-production/): I have reviewed hundreds of C# codebases across startups, enterprise systems, and large scale distributed architectures. Different industries, different teams, different domains yet the same harmful patterns show up everywhere. What makes these anti patterns dangerous is not that they break local development. They break production under load in ways that are hard to detect and even harder to debug. - [Outbox Pattern Done Right Real World Lessons from Distributed Systems](https://asadali.dev/blog/outbox-pattern-done-right-real-world-lessons-from-distributed-systems/): I have never worked on a distributed system where the Outbox Pattern was optional. It has always been the difference between a system that works reliably under failure and one that silently corrupts state. Yet I keep seeing teams implement it incorrectly or incompletely. What follows is not a theoretical explanation but the result of real outages, message storms, partial writes, and multi day incident investigations across microservices and event driven systems. - [example](https://asadali.dev/blog/example/): Long-form technical posts can be a lot. Below I break this topic into small, actionable pieces with war stories, a checklist, and a final scorecard so you can decide quickly. - [Mastering Polly for Building Resilient .NET APIs](https://asadali.dev/blog/mastering-polly-for-building-resilient-net-apis/): Resilience is not a luxury anymore. If your API calls external services, touches a database, or depends on any network boundary, you will face transient failures. Over the years I have watched production systems slow down, choke, or fail entirely because engineers assumed happy paths. Polly is the toolkit I always reach for when I need predictable, controlled resilience in .NET. - [The CQRS Mistakes I Keep Seeing in Real-World Systems](https://asadali.dev/blog/the-cqrs-mistakes-i-keep-seeing-in-real-world-systems/): Every few years, CQRS becomes fashionable again. Architects rediscover it, conferences hype it, and developers start splitting their codebases into commands and queries… even when they don’t need to. I’ve implemented CQRS in high-scale distributed systems, and I’ve also ripped it out of projects where it did more harm than good. This post is about the mistakes I see repeatedly — even in senior teams — and how to avoid them. - [Distributed Locks in Microservices — What Actually Works in Production](https://asadali.dev/blog/distributed-locks-in-microservices-what-actually-works-in-production/): Distributed locks are one of those topics that look deceptively simple when you read the theory… and then immediately explode in your face when you try to implement them in a real distributed system. I’ve had outages, race conditions, duplicate workflows, and state corruption caused by bad locking assumptions — enough scars to write this article with strong opinions. - [What’s New in EF Core 9 — What You Should Actually Care About](https://asadali.dev/blog/whats-new-in-ef-core-9-what-you-should-actually-care-about/): EF Core 9 launched in November 2024. It’s a “Short-Term Support” (STS) release — but with enough new features, performance optimisations, and provider updates that most serious projects should pay attention. In this post I walk you through the changes that matter operationally, the real gains (and tradeoffs), and how to approach upgrading existing systems. - [The Clean Architecture Mistakes I Keep Seeing (Even in Senior Teams)](https://asadali.dev/blog/the-clean-architecture-mistakes-i-keep-seeing-even-in-senior-teams-3/): I’ve been using, teaching, and reviewing Clean Architecture for years. And I’ll be honest: most teams don’t get it wrong because they don’t understand the theory. They get it wrong because the theory gets applied blindly—full of ceremony, layers, and abstractions that look clean on paper but collapse under real production pressure. - [The Clean Architecture Mistakes I Keep Seeing (Even in Senior Teams)](https://asadali.dev/blog/the-clean-architecture-mistakes-i-keep-seeing-even-in-senior-teams-2/): The Clean Architecture Mistakes I Keep Seeing (Even in Senior Teams) - [The Clean Architecture Mistakes I Keep Seeing (Even in Senior Teams)](https://asadali.dev/blog/the-clean-architecture-mistakes-i-keep-seeing-even-in-senior-teams/): I’ve been using, teaching, and reviewing Clean Architecture for years. And I’ll be honest: most teams don’t get it wrong because they don’t understand the theory. They get it wrong because the theory gets applied blindly—full of ceremony, layers, and abstractions that look clean on paper but collapse under real production pressure. - [Building resilient background processing with Azure Service Bus and .NET](https://asadali.dev/blog/building-resilient-background-processing-with-azure-service-bus-and-net/): I have a long history of shipping background processing at scale - everything from small worker jobs that run nightly to high throughput event-driven pipelines that process thousands of messages per minute. In this post I collect the patterns that actually worked for me in production, the mistakes that burned us, and pragmatic advice for building resilient consumers using Azure Service Bus and .NET. Expect code, concrete tradeoffs, and the sort of shoulder-scar stories you only get after debugging at 03:00 on a Friday. - [Designing High-Throughput, Idempotent Message Processing Pipelines with Azure Service Bus and .NET](https://asadali.dev/blog/high-throughput-idempotent-azure-service-bus-dotnet/): Let’s level-set the constraints first, because they drive almost every design decision: - [Designing High-Throughput, Tenant-Isolated Multi-tenant SaaS on Azure with ASP.NET Core and Azure SQL](https://asadali.dev/blog/designing-high-throughput-tenant-isolated-multi-tenant-saas-azure-aspnetcore-azuresql/): Multi-tenant SaaS on Azure with ASP.NET Core and Azure SQL looks deceptively simple on a whiteboard. In production, it’s a very different beast. - [Ultimate Typography & Component Test for Engineering Blog](https://asadali.dev/blog/ultimate-typography-component-test-for-engineering-blog/): Useful for major sections in technical posts. - [Multi-tenant SaaS: Practical comparison — Database-per-tenant vs Shared Schema](https://asadali.dev/blog/multi-tenant-saas-practical-comparison-database-per-tenant-vs-shared-schema/): Example: resolving tenant connection string in ASP.NET Core (simplified): - [Designing Multi-Tenant SaaS on Azure with ASP.NET Core: Database‑per‑Tenant vs Shared Schema at Scale](https://asadali.dev/blog/designing-multi-tenant-saas-azure-aspnet-core-database-per-tenant-vs-shared-schema/): Multi-tenancy looks deceptively simple on a whiteboard and painfully expensive when you try to change it in year three of your SaaS. - [Designing Multi-Tenant SaaS on Azure with ASP.NET Core and PostgreSQL/SQL Server: Sharding, Tenant Isolation, and Zero-Downtime Migrations](https://asadali.dev/blog/designing-multi-tenant-saas-azure-aspnetcore-postgresql-sqlserver/): Multi-tenant SaaS looks deceptively simple on diagrams and marketing decks. In practice, the first time you try to put a mission-critical, high-churn, noisy-neighbor SaaS on Azure with hundreds (or thousands) of tenants on top of PostgreSQL or SQL Server, you start discovering all the uncomfortable edges: runaway migrations, blocking tenants, shards you can't rebalance, and that one VIP customer who expects physical isolation, 24x7 uptime, and dedicated support—on your cheapest plan. - [Designing High-Throughput, Low-Latency Event‑Driven Architectures on Azure with .NET, Kafka, and Service Bus](https://asadali.dev/blog/high-throughput-low-latency-event-driven-architectures-azure-dotnet-kafka-service-bus/): If you build serious .NET systems on Azure long enough, you eventually hit the wall. - [Asad](https://asadali.dev/blog/asad/): public async Task PlaceOrderAsync(PlaceOrderCommand command, CancellationToken ct) { await using var tx = await _db.Database.BeginTransactionAsync(ct); var order = new Order(/* ... */); _db.Orders.Add(order); var evt = new OrderPlacedIntegrationEvent(order.Id, order.CustomerId, order.Total); var outboxMessage = OutboxMessage.CreateFrom(evt, aggregateId: order.Id.ToString()); _db.OutboxMessages.Add(outboxMessage); await _db.SaveChangesAsync(ct); await tx.CommitAsync(ct); } public sealed class OutboxMessage { public Guid Id { get; private set; } public string MessageType { get; private set; } = default!; public string Payload { get; private set; } = default!; public string? Metadata { get; private set; } public DateTime CreatedAtUtc { get; private set; } public byte Status { get; private set; } private OutboxMessage() { } // EF public static OutboxMessage CreateFrom(object @event, string? aggregateId = null) { return new OutboxMessage { Id = Guid.NewGuid(), MessageType = @event.GetType().FullName!, Payload = JsonSerializer.Serialize(@event, @event.GetType()), Metadata = JsonSerializer.Serialize(new { AggregateId = aggregateId, CorrelationId = Activity.Current?.TraceId.ToString(), CausationId = Activity.Current?.SpanId.ToString() }), CreatedAtUtc = DateTime.UtcNow, Status = 0 // Pending }; } } - [code highlithing](https://asadali.dev/blog/code-highlithing/): public class EngagementYear { public int Id { get; set; } public string OrganisationName { get; set; } public Datetime YearEnd { get; set; } }public class EngagementYear { public int Id { get; set; } public string OrganisationName { get; set; } public Datetime YearEnd { get; set; } } - [Designing High-Throughput, Resilient Background Processing in ASP.NET Core with Azure Service Bus and the EF Core Outbox Pattern](https://asadali.dev/blog/high-throughput-background-processing-aspnet-core-azure-service-bus-ef-core-outbox/): console.log("Hello world"); - [Designing High-Throughput, Idempotent Message Processing Pipelines in .NET with Azure Service Bus and EF Core](https://asadali.dev/blog/high-throughput-idempotent-message-processing-dotnet-azure-service-bus-ef-core/): There’s a very sharp line between “we have a queue and some workers” and a real, production-grade, high-throughput, idempotent pipeline. Most .NET teams discover that line the hard way—after a retry storm duplicates payments, a misconfigured outbox melts SQL Server, or a tiny bug in idempotency handling fans out into cross-tenant data corruption. In this article, I’ll walk through how I actually design and run Azure Service Bus + EF Core–backed pipelines in real systems: the patterns, the scars, and the trade-offs you only see once you’ve watched one of these pipelines fall over under load. - [Architecting Multi-Tenant SaaS Applications on Azure with ASP.NET Core and EF Core](https://asadali.dev/blog/architecting-multi-tenant-saas-azure-aspnetcore-efcore/): Multi-tenant SaaS looks deceptively simple on whiteboards and brutally unforgiving in production. The moment you mix ASP.NET Core, EF Core, Azure App Service, Azure SQL, Azure AD B2C, and a real billing story, you’ve signed up for a distributed systems problem dressed as “just another web app.” In this article I’m going to walk through how I actually design and operate multi-tenant SaaS platforms on Azure — the patterns that survive real incidents, the traps that will absolutely leak tenants or melt your shard, and the opinionated architecture I’d use if I had to ship a new SaaS platform tomorrow. - [Designing Scalable Multi-Tenant SaaS Applications with ASP.NET Core, EF Core, and Azure SQL](https://asadali.dev/blog/designing-scalable-multi-tenant-saas-applications-with-aspnet-core-ef-core-and-azure-sql/): In this article, I share my hard-won lessons on architecting multi-tenant SaaS applications using ASP.NET Core, EF Core, and Azure SQL. Drawing on real production experiences and industry surveys—with insights noting that 26.3% of developers favor ASP.NET Core and over 50% have adopted EF Core—I will detail the strategies that make a SaaS solution not only resilient and scalable, but also secure and cost-effective in today’s cloud-first world. - [Why DevOps Matters: Streamlining Software Delivery with Automation and Collaboration](https://asadali.dev/blog/why-devops-matters-streamlining-software-delivery-with-automation-and-collaboration/): In my 13+ years of building and operating production systems, I've seen firsthand how the successful implementation of DevOps principles can turn a struggling deployment process into a well-oiled machine. This article dives into why DevOps matters, explores its benefits for robust ASP.NET Core and Azure environments, and offers a production-hardened perspective of integrating automation and collaboration across teams. - [Why Learning ASP.NET Core is Essential for Modern Web Developers](https://asadali.dev/blog/why-learning-aspnet-core-is-essential-for-modern-web-developers/): ASP.NET Core isn’t just a framework—it’s a paradigm shift that modernizes how we build scalable, secure, and high-performance web applications. As someone who has architected distributed systems over 13+ years, I’ve seen firsthand how the design decisions in ASP.NET Core can mean the difference between a resilient service and a production failure. Today, we’ll break down why learning this framework is essential not only for writing clean code but for engineering enterprise-grade systems that thrive under pressure. - [Deep Dive into Azure Functions in C#: Building Enterprise-Grade Serverless Solutions](https://asadali.dev/blog/deep-dive-azure-functions-csharp-serverless/): In this article, I detail how to design, secure, and optimize Azure Functions in C# for sophisticated, enterprise-scale applications. This isn’t a beginner walkthrough; we’re dissecting the advanced internals, production pitfalls, and scaling challenges that real-world systems face. We’ll focus on hardened design principles, performance constraints, and security patterns expected in high-stakes environments. - [Getting Started with Azure Functions for C# Developers: A Beginner’s Guide](https://asadali.dev/blog/getting-started-with-azure-functions-for-csharp-developers-a-beginners-guide/): In this article, I share my journey with Azure Functions, a powerful serverless platform supported by C#. Designed with real-world production scenarios in mind, we will explore how to develop, deploy, and monitor Azure Functions while following enterprise-grade patterns. Whether you are just starting out or looking to refine your serverless architecture, this guide is packed with hands-on examples and insights from my 13+ years of backend engineering experience. - [Implementing CQRS with MediatR and Entity Framework Core in ASP.NET Core Web API (Real-World Guide)](https://asadali.dev/blog/implementing-cqrs-with-mediatr-and-ef-core/): In my 13+ years of engineering, I’ve seen how traditional CRUD patterns can lead to messy codebases, especially as applications scale. In this article, I discuss implementing CQRS using MediatR and EF Core in ASP.NET Core Web API. This approach improves maintainability, testability, and overall design by separating commands from queries, leveraging clean architecture principles directly in production scenarios. - [How to Build a Secure Multi-Tenant SaaS Application with ASP.NET Core, EF Core, and Azure SQL (Step-by-Step)](https://asadali.dev/blog/how-to-build-a-secure-multi-tenant-saas-application-with-aspnet-core-ef-core-and-azure-sql/): In today’s competitive cloud market, multi-tenant SaaS solutions allow a single application instance to securely serve multiple customers while optimizing resource usage. In this guide, I explain how to build a secure, scalable multi-tenant SaaS application leveraging ASP.NET Core, EF Core, and Azure SQL. We will cover tenant isolation strategies (database-per-tenant and schema-per-tenant), secure token-based authentication, and even look at automated provisioning with Azure Bicep/ARM templates. - [How to Build a Microservices Architecture with ASP.NET Core, MassTransit, RabbitMQ, and Azure Kubernetes Service (AKS)](https://asadali.dev/blog/how-to-build-a-microservices-architecture-with-aspnet-core-masstransit-rabbitmq-aks/): In this article, I will walk you through building a microservices architecture using ASP.NET Core, MassTransit, RabbitMQ for event-driven communication, and Azure Kubernetes Service (AKS) for orchestration. This guide is designed for senior .NET developers and architects who are looking to implement a scalable, production-grade system. We cover essential concepts, hands-on implementation steps, and infrastructure best practices. - [How to Build a Scalable Event-Driven Microservices Architecture in ASP.NET Core with MassTransit, RabbitMQ & Azure](https://asadali.dev/blog/how-to-build-a-scalable-event-driven-microservices-architecture-in-aspnet-core-with-masstransit-rabbitmq-azure/): In today’s cloud-centric application landscape, event-driven architectures have emerged as a robust solution for building scalable and resilient microservices. In this article, I will walk you through a production-grade setup using ASP.NET Core, MassTransit, RabbitMQ, and Azure. This guide is intended for senior engineers, architects, and DevOps professionals looking to effectively manage distributed business workflows and ensure reliable messaging in cloud environments. - [How to Build a Scalable Event-Driven Microservices Architecture in ASP.NET Core with MassTransit, RabbitMQ & Azure](https://asadali.dev/blog/how-to-build-a-scalable-event-driven-microservices-architecture-in-asp-net-core-with-masstransit-rabbitmq-azure/): \n\n - [How to Implement the Transactional Outbox Pattern with Entity Framework Core and MassTransit in ASP.NET Core Microservices](https://asadali.dev/blog/how-to-implement-the-transactional-outbox-pattern-with-entity-framework-core-and-masstransit-in-asp-net-core-microservices/): Today, I want to walk you through one of the most essential patterns in microservices architectures – the transactional outbox pattern. In this post, I explain how to implement this pattern using Entity Framework Core and MassTransit in ASP.NET Core microservices. We’ll see how this approach addresses the consistency issues between our write databases and RabbitMQ message brokers, ensuring reliable message delivery in event-driven systems. - [Step-by-Step Guide to Deploy ASP.NET Core Microservices on Azure Kubernetes Service (AKS) Using Bicep and Azure Container Registry](https://asadali.dev/blog/step-by-step-guide-to-deploy-asp-net-core-microservices-on-azure-kubernetes-service-aks-using-bicep-and-azure-container-registry/): In today’s competitive cloud landscape, the demand for scalable, containerized, and cloud-native architectures is higher than ever. This guide walks you through deploying ASP.NET Core microservices on Azure Kubernetes Service (AKS) using the modern Infrastructure as Code tool Bicep along with Docker and Azure Container Registry (ACR). Whether you're a seasoned C# developer, a DevOps engineer, or an architect, this comprehensive tutorial provides practical, real-world examples to help you build a production-grade Kubernetes environment. - [Implementing Event-Driven Microservices with ASP.NET Core, MassTransit, RabbitMQ, and EF Core](https://asadali.dev/blog/implementing-event-driven-microservices-with-asp-net-core-masstransit-rabbitmq-and-ef-core/): In today’s distributed architectures, event-driven microservices have become a definitive strategy for building scalable applications. This detailed guide will walk you through how to build such systems employing ASP.NET Core, MassTransit, RabbitMQ, and EF Core. By integrating Domain-Driven Design (DDD) and Command Query Responsibility Segregation (CQRS), we can maintain consistency in complex business scenarios. Dive in as we explore best practices, pitfalls, and practical code examples to master these technologies. - [How to Deploy a Production-Grade ASP.NET Core Web API with SQL Server on Azure Kubernetes Service Using Bicep and Terraform](https://asadali.dev/blog/how-to-deploy-a-production-grade-asp-net-core-web-api-with-sql-server-on-azure-kubernetes-service-using-bicep-and-terraform/): If you're a .NET developer or DevOps engineer looking to modernize your deployment strategy, this guide will take you through deploying a production-ready ASP.NET Core Web API with SQL Server on Azure Kubernetes Service (AKS). Using Infrastructure as Code (IaC) techniques with Bicep and Terraform, we'll cover how to set up your environment, containerize your application, provision resources, and secure your data connections—all while following best practices and avoiding common pitfalls. - [Implementing CQRS with MediatR and Entity Framework Core in ASP.NET Core Web API (Step-by-Step Guide)](https://asadali.dev/blog/implementing-cqrs-with-mediatr-and-entity-framework-core-in-asp-net-core-web-api-step-by-step-guide/): Step-by-Step Guide: Deploying ASP.NET Core Web API with EF Core & SQL Server on AKS using Bicep & ACR - [Step-by-Step Guide to Implementing Multi-Tenant Architecture in ASP.NET Core Web API with EF Core and SQL Server](https://asadali.dev/blog/step-by-step-guide-to-implementing-multi-tenant-architecture-in-asp-net-core-web-api-with-ef-core-and-sql-server/): Step-by-Step Guide: Deploying ASP.NET Core Web API with EF Core & SQL Server on AKS using Bicep & ACR - [Step-by-Step Guide: Deploying ASP.NET Core Web API with EF Core & SQL Server on Azure Kubernetes Service Using Bicep & ACR](https://asadali.dev/blog/step-by-step-guide-deploying-asp-net-core-web-api-with-ef-core-sql-server-on-azure-kubernetes-service-using-bicep-acr/): Step-by-Step Guide: Deploying ASP.NET Core Web API with EF Core & SQL Server on AKS using Bicep & ACR - [Hello world!](https://asadali.dev/blog/hello-world/): Welcome to WordPress. This is your first post. Edit or delete it, then start writing! ## Pages - [Subscription Confirmed](https://asadali.dev/newsletter-confirmed/): Read the latest article - [Contact Me](https://asadali.dev/contact-me/): Have a question, a collaboration idea, or anything else you'd like to discuss?I'd love to hear from you. Feel free to reach out anytime. - [About Me](https://asadali.dev/about-me/): About Me Hi — I’m Asad Ali. I share practical guidance to help engineers strengthen their expertise in .NET development and software architecture. I’m a Technical Lead with extensive experience designing and building distributed, large-scale systems across different domains. I share practical, real-world insights with thousands of developers through my social media channels and my .NET Weekly newsletter. My goal is to pass on the lessons I've learned while architecting and maintaining complex enterprise applications, so you can build better software with confidence. - [Blog](https://asadali.dev/blog/) - [Home](https://asadali.dev/)