How to Implement Log4net in C#/.NET
In this article, we will learn how to implement Log4net, a logging framework for C# applications, and how to use it effectively. Knowing how to log properly helps us to be more efficient while debugging, monitoring, and maintaining our applications. [sc name="github"...
Dynamically Change the ServiceLifetime of a Registered Service in .NET
Managing dependencies is essential in modern application development. .NET provides a powerful Dependency Injection (DI) system, with ServiceCollection at its core. Typically, we register a service and use it as is. However, there are instances when we need to change...
Differences Between Record Struct and Record Class in C#
In this article, we'll discuss the differences between record struct and record class in C#. First, we will shortly explain each of the types. Afterward, we'll show and describe each difference between them. [sc name="github"...
Advanced Debugging in C#
In this article, we'll be talking about advanced debugging and inspecting data in C#. We'll be using Visual Studio 2022 to demonstrate all the debugging techniques. For more information about general debugging, we have another article on the basics of debugging, so...
Run a Large Language Model(LLM) Like ChatGPT Locally With C#
We are quickly entering the era of AI in Tech and software development. AIs are no longer relegated to research labs. More recently, we have gained access to using AI on the web and even on our personal devices. Now, we can run AIs locally on our personal computers....
What are the Differences Between Onion Architecture and Clean Architecture in .NET?
In this article, we are going to discuss the differences between onion architecture and clean architecture in .NET. These patterns are often used interchangeably, and while they are very similar, there are some key differences that we will highlight. [sc name="github"...
Implementing the Saga Pattern Using Rebus and RabbitMQ
In this article, we provide a technical guide on implementing the Saga Pattern using Rebus and RabbitMQ in a .NET environment. Rebus is a .NET library designed to create distributed applications with messaging capabilities, simplifying the process of sending and...
How to Cancel an HTTP Request on Leaving a Blazor Component
This article explores how to cancel an HTTP request and the associated backend operation inside a Blazor component. After a brief introduction to the architecture for canceling backend operations, we will familiarize ourselves with cancellation tokens and how to...
Template Method Design Pattern in C#
In this article, we will talk about a behavioral design pattern, the Template Method Pattern. We are going to see how this pattern helps deal with certain design problems and how to implement it in C#. [sc name="github"...
The LINQ Where Method in C#
In this article, we'll focus on the use cases of the LINQ Where Method in C#. The LINQ Where Method offers a powerful tool that can manipulate data from...
Multi-Source Data Integration With Strawberry Shake Subscriptions
When we need multi-source data integration, Strawberry Shake allows us to wire up GraphQL with Subscriptions to implement a pub-sub system. [sc name="github"...
How to Convert a Stream to a File in C#
In this article, we'll discuss how to convert a stream to a file in C#. We will demonstrate different ways to do that, discuss the advantages and disadvantages of each, and see when one way could be more suitable. [sc name="github"...
How to Test IServiceCollection Registrations in .NET
Unit testing IServiceCollection registrations in .NET enables us to test our application's IServiceCollection to confirm that the setup of dependency injection is correct, allowing us to catch errors early in development. E.g. if we fail to register a service or...
Using EF Core Interceptors in .NET
Entity Framework Core (EF Core) has many powerful features, with Interceptors being one of the most versatile. Interceptors allow us to plug in custom behavior at different stages of the EF Core operation pipeline, giving us enhanced control over data interaction...
Generate Images Using OpenAI in an ASP.NET Core Application
In this article, we are going to explore how to generate images in an ASP.NET Core application using OpenAI. Let's get going....
Abstract Factory Design Pattern in C#
The Abstract Factory design pattern is a creational pattern that handles object instantiations. It offers a framework to manage complex object creation scenarios and helps us achieve a more maintainable code structure. In this article, we'll look into the Abstract...
Improve Entity Framework Core Performance with Complex Types
In this article, let's explore what Complex Types are in Entity Framework Core and how we can use them to improve the performance of our .NET applications. [sc name="github"...
How to Find All the Positions of a Substring in Another String in C#
In this article, we are going to learn how to find all the positions of a substring in another string. So we are trying to find, for...
How to Read appsettings.json in a .NET Console Application
In this article, we will learn how to read appsettings.json in a .NET console application. Explanation Of appsettings.json The appsettings.json file in .NET applications serves as a centralized repository for configuration settings, utilizing the JSON format for its...
Bridge Design Pattern in C#
In this article, we are going to talk about a structural design pattern, the Bridge Pattern. We will discuss what problem this pattern solves and how to implement it in C#. [sc name="github"...