Latest Posts On Code Maze

Fast Inserts With Entity Framework (EF Core)

Fast Inserts With Entity Framework (EF Core)

In this article, we will review multiple ways of performing fast inserts of bulk data into a database using the Entity Framework (EF for short). Entity Framework "classic" was introduced in 2008, was superseded nearly a decade later by EF Core, and continues to add...

Easy Sorting, Filtering and Pagination in .NET With Sieve Package

Easy Sorting, Filtering and Pagination in .NET With Sieve Package

Most applications that are developed nowadays usually involve interacting with non-trivial amounts of data, so we need to provide functionality for sorting and filtering in our applications. Moreover, speed and load times are increasingly important, so we don't want...

How to Return XML From ASP.NET Core Web API

How to Return XML From ASP.NET Core Web API

ASP.NET Core is a powerful and flexible platform for building web applications. It supports multiple data formats, including JSON and XML, and provides many tools for serialization and deserialization. In this article, we will focus on how to return XML from ASP.NET...

Short Circuit Evaluation of IF Statements with Await in C#

Short Circuit Evaluation of IF Statements with Await in C#

In this article, we are going to look at what exactly short circuit evaluation is in C# and how asynchronous calls are affecting it. [sc name="github" url="https://github.com/CodeMazeBlog/CodeMazeGuides/tree/main/async-csharp/ShortCircuitEvaluationWithAsyncAwait"...

How to Serialize Exceptions as JSON in .NET

How to Serialize Exceptions as JSON in .NET

In this article, we will learn how to serialize exceptions as JSON in .NET. Good exception handling is one of the key aspects of a successful enterprise application. And when we talk about an API, it's important that we provide relevant failure details to consumer...

Resource-Based Authorization in ASP.NET Core

Resource-Based Authorization in ASP.NET Core

When authorizing requests in ASP.NET Core Web API projects, it's not enough to know the endpoint and the user; we also need to be aware of the specific resource the user is trying to access. In this article, we will learn how to tackle these situations using...

Property Ordering in C# JSON Serialization

Property Ordering in C# JSON Serialization

In this article, we are going to learn how to perform property ordering within JSON serialization using the two most famous JSON libraries for .NET. The libraries are System.Text.Json, which has been natively available in the framework since .NET Core 3.0, and...

Aggregate Design in .NET

Aggregate Design in .NET

In this article, we will learn what is an aggregate in Domain-Driven Design. We will get to know which are the main design principles behind it. We will, also, design and implement a simple use case using these principles and learn how to organize business logic and...

Different Ways to Split a String in C#

Different Ways to Split a String in C#

In this article, we will cover different ways to split a string in C#. As developers, we might often need to split strings into smaller substrings based on certain delimiters. C# provides us with the Split method, which is part of the String class. [sc name="github"...

Upcasting and Downcasting in C#

Upcasting and Downcasting in C#

Upcasting and downcasting are important concepts in C# programming that allow us to convert an object of one type to another type. These concepts are essential to work with polymorphism and object-oriented programming. In this article, we will explore how upcasting...

How to Validate Email Address in C#

How to Validate Email Address in C#

Validating an email address is a common task in the routine of a software developer, especially when we build applications that deal with users' data. In this article, we are going to explore a few different ways to validate email addresses. First, we'll use built-in...

How to Round Down a Number to a Nearest Integer in C#

How to Round Down a Number to a Nearest Integer in C#

In this article, we will explore C# possibilities when we want to round down a number to the nearest integer. We will do that by testing several methods, which would probably first cross the minds of developers when solving this task. [sc name="github"...

How to Do an Inner Join in LINQ?

How to Do an Inner Join in LINQ?

This article guides us on how to do an inner join in LINQ. We are going to discover how to seamlessly extract linked data and carry out additional LINQ tasks in conjunction with the join. Additionally, we also explore how to perform multi-level joins, that are...

How to Declare an Empty Array in C#

How to Declare an Empty Array in C#

In this article, we are going to look at the numerous ways to declare an empty array in C#. Arrays are used to store multiple variables of the same type. Sometimes our solution design may require the use of an empty array. For example, as an initial value for a...