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. [sc...
How to Get a JSON Array Using IConfiguration in ASP.NET Core
In this article, we will explore how to get a JSON array using IConfiguration. In modern web applications, JSON is a widely used data interchange format due to its lightweight nature and ease of use. When developing an ASP.NET Core application, it is common to store...
Deploy ASP.NET Core Applications on Linux With Apache
In this article, we are going to learn how to deploy ASP.NET Core applications to an Ubuntu Linux server with Apache. Let's get...
Adding Header and Footer to a PDF Using the iText Library in C#/.NET
In this article, we will continue our journey using the iText library to create PDF documents. In our previous article, 'Introduction to PDF Manipulation With iText (Formerly iTextSharp)' we discussed the basics of the iText7 library. We talked about licensing and the...
Readonly Modifier in C#
In this article, we are going to learn about the readonly modifier in C#. However, before we go into detail on this topic, it is important to understand the concepts of mutability and immutability in programming. [sc name="github"...
How to Use Mutex in C#
In this article, we are going to learn how to use the Mutex class in C#. Multithreading can significantly boost an application's performance, but it also brings challenges related to synchronizing and coordinating tasks across different threads (and even processes)....
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"...
How to Solve the HTTP Error 500.31 – Failed to Load ASP.NET Core Runtime Error
In this article, we will learn about the HTTP Error 500.31 generated by IIS, what causes it, and how we can solve it. Let's start. HTTP Error 500.31 Description We've just published our first .NET Core application on the IIS, and we're eager to see how it looks. We...
Targeting Multiple Frameworks in a .NET Project
In this article, we're going to explain the importance and benefits of targeting multiple frameworks in a single .NET project. Let's start....
Prevent SQL Injection With EF Core, Dapper, and ADO.NET
SQL Injection is a severe security vulnerability that can harm applications that use databases. In this article, we'll learn about SQL Injection attacks, what they can do, and how to protect our applications from them. We'll focus on using popular ORM tools like EF...
How to Generate a Stream From a String?
Generating a stream from a string is a common operation we perform when building applications. In this article, we will discuss two ways we can achieve that in .NET. [sc name="github"...
Differences Between Const and Readonly in C#
In this article, we will discuss the differences between const and readonly keywords in C#. const and readonly allow us to declare immutable values in C#. [sc name="github"...
How to Determine .NET Version Programatically
.NET Framework allows us to create applications for various platforms and devices. With each new version, .NET introduces new features and fixes, while rarely including changes that could cause compatibility issues. Therefore, upgrading a .NET project to a newer...
Differences Between Equality Operator (==) And Equals Method In C#
In this article, we delve into the similarities and differences between the equality (==) operator and the Equals method in C#. [sc name="github"...
Primary Constructors for Classes and Structs in C#
In this article, we'll take a look at a new feature of C# 12 and .NET 8 for classes and structs called primary constructors that is still in preview at the time of writing the article. [sc name="github"...
How to Configure Rolling File Logging With Serilog
Logging holds a crucial role in software development, as it provides software engineers valuable insights into the behavior and health of their applications. Moreover, Serilog, a popular logging framework for .NET applications, offers a wide range of features. One...




