API is an acronym for “Application Program Interface”. A WEB API can be used in many kinds of applications and acts as a kind of mediator between two applications. If you are creating a website, or a Single Page Application (SPA), or a mobile application, or when you need to communicate to a service on the server-side, or even if one application needs to communicate with another application (for example: a client to a server), an API can be used for that. It’s also possible to use API with Artificial Intelligence, Machine Learning, Cloud, Microservices, Big data, and many other…

Monolithic and Microservices Architecture are two different approaches that can be used to create an application, and each approach has its pros and cons. In this article I explain the main difference between them, and what are some of the benefits and challenges of each architecture.

Monolithic Architecture

A Monolith is a software application that typically contains all the code in a single code base. When working with .NET Core, for example, the whole application will be inside of a single solution file, and in a monolithic architecture, the application will connect into a single database. This is a very…

A new feature that was added on Entity Framework Core 5, it’s the possibility to create a Table-per-Type (TPT) mapping. In this article, I explain the difference between the Table-per-Hierarchy (TPH) mapping and the Table-per-Type (TPT) mapping.

By default, EF Core maps an inheritance hierarchy of .NET types to a single table in the database, to store the data for all types in the hierarchy, and a discriminator column is used to identify which type each row represents, this is known as Table-per-Hierarchy (TPH) mapping.

With EF Core 5, it’s also possible to map each .NET type in an inheritance…

A new feature on Entity Framework Core 5, it’s the possibility to split a query into multiple SQL queries. On EF Core 3.0 for example, a single query was generated for each LINQ query, but now on EF Core 5, there is the possibility to split the query. In this article, I will explain the difference between them.

To show the differences between the default query and the split query, I’ve created a console application using .NET Core 5.0, and I’ve installed the packages:

  • Microsoft.EntityFrameworkCore.Design 5.0.3
  • Microsoft.EntityFrameworkCore.SqlServer 5.0.3
  • Microsoft.EntityFrameworkCore.Tools 5.0.3

On the Startup class, in the method OnConfiguring, I enabled…

In this article, we will migrate a WEB API application from .NET Core 3.1 to .NET 5.0.


For this migration, I will be using Visual Studio. The first step it’s necessary to do is:

  • download the Visual Studio 2019 16.8 or later, with the ASP.NET and web development workload. Visual Studio 2019 can be downloaded here.
  • Download .NET 5.0 SDK or later, which can be downloaded here.

For this example, I’m using a project that can be found on my GitHub at this repository: https://github.com/henriquesd/MigratingFromDotNet3.1To5.0

Open the solution with Visual Studio, right-click on the project, click on “Properties”, and…

Dependency Injection (DI) is a design pattern which supports the development of loosely coupled code, and it’s also one of the SOLID principles (Dependency Inversion Principle). On this article, I will explain how we can use Dependency Injection and what is the difference between the three services lifetimes that can be used in .NET Core applications.

“Dependency Injection (DI) is a technique that provides dependencies to a class, thereby achieving dependency inversion. Dependencies are passed (injected) to a client that needs it.”

DI is used a lot in .NET Core applications, and also the own framework brings it natively. …

In this article we are going to see how to create the unit tests for the Repository classes in the Infrastructure layer, using an In-Memory database.

The Repository classes are responsible for handle the data into the database. There are at least three ways to create unit tests for these classes, one way is using a real database, which I do not recommend because the tests must be isolated from each other, and to do that it would be necessary to create a new database for each test, but this will make the tests run very slow. Another way is…

A new feature that is released with the new version of the Entity Framework Core is the possibility to create a Many-to-Many relationship without explicitly mapping the join table. On this article, we are going to see how we can create a Many-to-Many relationship using Entity Framework Core 5.

On the previous versions of EF Core, to create a many-to-many relationship, it’s necessary to have a third entity. For example, to create a many-to-many relationship between the entity Actor and the entity Movie, it is necessary to have three entities: Actor, Movie, and ActorMovie. On the article “Entity Framework Core…

In this article we are going to see how to create the unit tests for the Controllers in the API layer. To create these unit tests we are also going to use the xUnit and Moq framework.

Creating the Unit Test project for the API layer

Let’s start creating a new xUnit project for the API layer, similar to the one we created for the domain layer in the previous article (you can read the previous article clicking here). Open the solution with Visual Studio, and create a new xUnit project and add it on the “test” folder:

In this article we are going to see how we can create the unit tests for the Services classes in the Domain layer, using xUnit framework.

The three most commons unit test frameworks for .NET are:

  • XUnit — The newest from this list. It was written by the original inventor of NUnit v2. This framework is used by the development team of .NET Core and ASP.NET.
  • NUnit — A JUnit version for .NET.
  • MSTest — Framework from Microsoft.

The goal of the unit test, it’s to verify each unit from the software, in isolation, to guarantee that each unit of…

Henrique Siebert Domareski

.NET Full-Stack Developer | C# | .NET | .NET CORE | ASP.NET MVC | Unit Test | Angular

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store