How to Access Configuration During Application’s Startup in .NET
In this article, we are going to explain how to access the configuration when the application is starting and how to retrieve services like IConfiguration and IWebHostEnvironment in this new setup. [sc name="github"...
Adding a User Login to a .NET App With Auth0
When creating applications, authenticating users and ensuring the security of user data is paramount. To accomplish this, we can either create a custom authentication solution or leverage a third-party solution. In this article, we'll learn about adding a user login...
How to Split an Entity Into Multiple Tables in EF Core
In this article, we will learn how to split an entity into multiple tables in EF Core. This is a new feature that we can find in version 7.0 of Entity Framework Core. [sc name="github"...
Sending Email With FluentEmail in .NET
In this article, we are going to learn how to send emails using FluentEmail in an ASP.NET Core Web API application. FluentEmail is a popular open-source library for sending emails from .NET applications. It provides an easy-to-use fluent interface. That means we can...
XML Deserialization in C#
In the world of C#, XML deserialization is a powerful technique that allows developers to convert XML data into strongly typed objects seamlessly. That said, in this article, we will learn more about XML deserialization in C#. We will cover essential concepts, hence,...
Genearate PDFs With iText in C#/.NET (Formerly iTextSharp)
In this article, we will learn how to generate PDFs using the iText library in C# and delve into the nuances of manipulating PDF documents using the iText library. [sc name="github"...
Saga Pattern With NServiceBus in C#
Navigating the world of distributed systems and microservices in C#? Then we should appreciate the combination of the Saga Pattern and NServiceBus. This powerful pairing provides us with an efficient solution for coordinating long-running, distributed transactions in...
Should We Use Records or Classes or Structs in C#
Classes and structs have been a part of C# since version 1.0, but more recently records have been added. In this article, we will compare these three structures to see how they each have a use-case where they are the best data structure to use. [sc name="github"...
How to Solve Unable to Resolve Service for a Type
Dependency Injection plays a crucial role in building maintainable applications in .NET Core. It helps in building loosely coupled services that are scalable and less prone to bugs in the long run. However, sometimes we might encounter the error message "Unable to...
Introduction to Scrutor Library in .NET
In this article, we will explore the Scrutor library, learn about its use cases, what it offers to simplify dependency injection, and the implementation of cross-cutting concerns using the decorator pattern. [sc name="github"...
How to Efficiently Randomize an Array in C#
In this article, we will look at how we can efficiently randomize an array in C#. We'll explore several ways of achieving that and then we'll compare the performance of each approach. [sc name="github"...
MediatR Publish and Send Methods
In this article, we are going to explore the key differences between the Publish and Send methods in MediatR, a powerful .NET library for component communication. [sc name="github"...
Required Parameters in Blazor WebAssembly
When we want to pass data in Blazor from a parent component to a child component, we use parameters. Parameters are defined on the component class with the Parameter attribute. If we define the parameter in the child component but don't pass a parameter from the...
EntityFramework Core vs Dapper
In this article, we will discuss the differences between EntityFramework Core and Dapper. EntityFramework Core and Dapper are .NET...
StyleCop Analyzers Implementation in .NET
As developers, we often have different ideas for writing our code. While coding style preferences can differ, being consistent is important. In this article, we will explore the benefits of StyleCop Analyzers and how they can help us enforce a unified coding style...
Compare Byte Arrays in .NET
In .NET, byte arrays are a common data type used to represent a sequence of bytes. They often represent binary data such as images, audio files, or serialized objects. Comparing byte arrays in .NET requires a good understanding of how the .NET framework handles arrays...
How to Integrate BenchmarkDotNet With Unit Tests
In this article, we will learn how to integrate BenchmarkDotNet with Unit Tests and use some advanced APIs of the BenchmarkDotNet library when doing that. In the .NET ecosystem, BenchmarkDotNet is the go-to library for conducting performance benchmarks. Typically we...
Firebase Authentication in .NET
Authentication is inherently a complex topic to understand and implement in our applications. So, generally, we avoid writing the logic from scratch and opt for an off-the-shelf solution. Firebase, the cloud solution from Google, provides an authentication service...
Discriminated Unions in C#
In this article, we will look at the usage of discriminated unions in C#, specifically with the open-source library OneOf. We'll go into some practical examples and why this pattern is becoming increasingly popular in .NET applications today. First, let's talk about...
Converting a Byte Array to Hexadecimal String in C#
In this article, we will look at converting a byte array to a hexadecimal string. Converting between byte arrays and hexadecimal strings is a common occurrence in computer programming. Hexadecimal strings have the advantage of being both human-readable and easy to...
Roslyn Compiler and Analyzers in .NET – Introduction
In this article, we will introduce Roslyn compiler and analyzers in .NET. Moreover, we will delve into utilizing Roslyn to compile C# code and explore various types of Roslyn analyzers. Roslyn is an open-source compiler for C# and Visual Basic. Roslyn exposes a wide...