Latest Posts On Code Maze

How to Use Basic Authentication With HttpClient?

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...

Differences Between Any and Exists Methods in C#

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...

Dynamically Switching DbContext at Runtime Using Entity Framework Core

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...

How to Mark Methods as Deprecated in C#

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"...

Implement API Key Authentication in ASP.NET Core

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

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"...