Skip to main content

Posts

How to Build a RAG Chatbot in C# with Semantic Kernel

Learn how to build a RAG chatbot in C# with Semantic Kernel. Step-by-step tutorial with runnable code for chatting with your own documents. Start now! Large language models are impressive, but they know nothing about your data: your internal wiki, your PDF manuals, your support tickets. Retrieval-Augmented Generation (RAG) fixes that. In this tutorial you will build a RAG chatbot in C# with Microsoft's Semantic Kernel that ingests your own documents, stores them as vector embeddings, retrieves the most relevant chunks for each question, and answers with citations. Every example is runnable .NET 8/9 code, and along the way we explain why each design choice matters, not just how to wire it up. What Is a RAG Chatbot and Why Build One in C#? RAG is a simple idea with a big payoff. Instead of fine-tuning a model on your documents (expensive, slow, and stale the moment your docs change), you keep the model as-is and retrieve relevant text at query time, then hand that text to ...

TDD in C# with xUnit and Moq: Test-Driven Development Guide

Learn test-driven development in C# with xUnit and Moq. Step-by-step TDD tutorial with runnable code, best practices, and pitfalls. Start writing tests first today. Test driven development in C# flips the usual workflow on its head: you write a failing test first, then write just enough production code to make it pass, then clean up. It sounds slow. In practice, teams that adopt TDD with xUnit and Moq ship fewer bugs, refactor with confidence, and end up with a design that is naturally decoupled and testable. This guide walks you through the full red-green-refactor cycle in .NET, with runnable examples, mocking with Moq, and the mistakes that trip up most developers when they first try TDD. What Is Test Driven Development in C#? TDD is a development discipline with three short, repeating steps: Red – write a small test that describes behaviour you want. Run it. It fails (often it doesn't even compile). Green – write the simplest production code that makes the test ...

Entity Framework Core 9 Tutorial: Migrations & Performance

Learn Entity Framework Core 9 migrations, relationships, and performance tips with runnable C# examples. Master EF Core 9 best practices today. Entity Framework Core is the default data-access layer for modern .NET applications, and Entity Framework Core 9 (shipped with .NET 9) is the most capable release yet. Whether you're a beginner learning how to create your first migration, an intermediate developer looking for EF Core best practices, or a senior engineer hunting down slow queries, this Entity Framework Core 9 tutorial covers the three areas that matter most in real projects: migrations , relationships , and performance . Every example is runnable C# you can drop into an ASP.NET Core or console app. What's New in Entity Framework Core 9? Before diving in, here's why EF Core 9 is worth upgrading to: Improved LINQ translation — more queries translate to SQL instead of throwing "could not be translated" exceptions, including better support for GroupB...

Azure Blob Storage C# Tutorial: Upload & Download Files

Learn Azure Blob Storage in C# with .NET 8: upload, download, list, and delete files using the Azure.Storage.Blobs SDK. Runnable code examples inside. If you are building a .NET application that needs to store images, documents, backups, logs, or any unstructured data in the cloud, Azure Blob Storage with C# is the go-to solution. It is cheap, virtually unlimited in scale, and the official Azure.Storage.Blobs SDK makes it straightforward to upload, download, list, and delete files from any .NET 8 app. In this tutorial you will learn how Azure Blob Storage works, how to connect to it securely from C#, and how to perform every common file operation with runnable code — plus the best practices and pitfalls that trip up most developers in production. What Is Azure Blob Storage and Why Use It From C#? Azure Blob Storage is Microsoft's object storage service for unstructured data. "Blob" stands for Binary Large Object — a fancy name for "any file". Instead of...

OWASP Top 10 for .NET Developers: Fix Every Risk (2026)

Learn the OWASP Top 10 for .NET developers with C# code fixes for every vulnerability — SQL injection, broken access control, and more. Start securing your apps today. The OWASP Top 10 is the most widely used awareness document in application security, and the latest edition reshuffles the list in ways that matter directly to .NET developers. Broken Access Control keeps its #1 spot, Security Misconfiguration jumps to #2, and a brand-new category — Software Supply Chain Failures — lands at #3, reflecting how often modern apps are compromised through NuGet packages and build pipelines rather than the code you wrote yourself. This guide walks through every category in the current OWASP Top 10, explains why each vulnerability happens in ASP.NET Core applications, and shows you exactly how to fix it with practical C# code. Whether you're a beginner searching "how to prevent SQL injection in C#" or a senior engineer hardening a production API, there's something here...

Semantic Kernel C# Tutorial: Build AI Agents Step by Step

Learn Microsoft Semantic Kernel in C# with this step-by-step tutorial. Build AI agents, plugins, and copilots in .NET with runnable code. Start today. If you want to add real AI capabilities to a .NET application, Semantic Kernel C# is the fastest, most production-ready route available today. Microsoft Semantic Kernel (SK) is an open-source SDK that lets you plug large language models like GPT-4o, Claude, or local models into ordinary C# code, give them tools (called plugins ), and let them plan and execute multi-step tasks. In this Semantic Kernel tutorial you will build an AI agent step by step: from a "hello world" chat completion, through function calling with your own C# methods, to a stateful copilot that can answer questions about your own data. Every example targets .NET 8 or later and uses the stable Microsoft.SemanticKernel package. You can copy the code straight into a console app and run it. What Is Microsoft Semantic Kernel and Why Use It in C#? At its...