How to Use Basic Authentication With HttpClient?
In this article, we are going to discuss how to use basic authentication with HttpClient. While the topic may seem straightforward, there are a few different ways to solve this problem. We'll try and cover some of the main approaches, and hopefully, by the end, we...
Testing Using Testcontainers for .NET and Docker
In this article, we'll explore how to use the Testcontainers library for testing .NET applications using Docker. Let's get...
Differences Between Any and Exists Methods in C#
In this article, we will explore the differences between Any() and Exists() methods in C#. Although at first glance they might seem similar, they possess distinct characteristics and we use them in different scenarios in order to manipulate data collections. Visual Studio is a great tool. But it has so many...
Optimistic Concurrency in ASP.NET Core Web API
In this article, we'll discuss a few approaches to implementing optimistic concurrency in ASP.NET Core Web API. Let's begin. Understanding...
How to Return HTTP 500 From ASP.NET Core Web API
In this article, we will learn about the different ways to return a 500 status code with ASP.NET Core Web API controller actions. Let's start!...
Dynamically Switching DbContext at Runtime Using Entity Framework Core
In this article, we will discuss why having multiple databases behind an application is useful and how dynamically switching an EF DbContext can be achieved without experiencing downtime. Feel free to check out our series of articles on Entity Framework Core. Clean and easy-to-implement guide to logging with Serilog using Azure...
Efficiently Converting Strings With UTF-8 String Literals in C#
In this article, we'll learn about the new syntax for UTF-8 string literals in C# 11, highlighting the performance enhancements vs. the older API. ...
How to Mark Methods as Deprecated in C#
In this article, we will explore how we can mark methods as deprecated and propose newer alternatives to developers in C# by providing useful information. [sc name="github"...
How to Conditionally Resolve Dependencies in .NET
In this article, we will learn how to conditionally resolve dependencies in .NET. Conditional dependency resolution is a...
Implement API Key Authentication in ASP.NET Core
Many developers widely use API key authentication to secure API endpoints. This approach necessitates clients to provide a valid API key for accessing the endpoints. When implementing API key authentication in ASP.NET Core, it's crucial to understand how to pass the...
How to Mock IOptions in ASP.NET Core
In this article, we'll unveil a straightforward approach to mock IOptions<T>, ensuring our tests remain both thorough and independent of real-world configurations. [sc name="github"...