Latest Articles

 | Patrick Jahr

Stockende UI, langsame Reaktion nach dem Klick auf einen Button oder einer Eingabe in einem Feld – dies sind nur wenige Beispiele für alltägliche Probleme, die beim Benutzen von Client-Anwendungen im Allgemeinen, und bei Webanwendungen im Speziellen immer wieder auftreten können. Bei der Entwicklung von SPAs, und so...

Read article
 | Sebastian Gingter

Mit der Einführung von async/await in C# 5 (2012) wurde das asynchrone Programmieren auf Basis von Tasks deutlich einfacher. Nebenläufigkeit ist allerdings grundsätzlich kein einfaches Thema, und wenn die Reihenfolge der Ausführung nicht mehr rein sequenziell ist, passieren schlimme Dinge können.

Read article
 | Patrick Jahr

Ein Großteil an Softwarelösungen hantiert mit Daten. Formulare sind hier kaum wegzudenken und ein zentraler Bestandteil. Sei es das Anmelden über eine Login-Maske oder das Buchen von Konzertkarten, überall sind Sie zu finden. In dieser Session zeigt Patrick Jahr anhand eines Beispiels wie Formulare mit Blazor...

Read article
 | Pawel Gerr

This article is the 3rd part of a series about Roslyn Source Generators & co. In the 1st article, of this series, we built a Source Generator to generate a new property Items of a smart-enum. In the 2nd article, we added a Roslyn Analyzer and a Code Fix to prevent common mistake(s) and to help out the developers when...

Read article
 | Boris Wilhelms

Thinking and even recommending a monolithic architecture these days seems antiquated. While a microservices architecture clearly has its benefits, it also comes with drawbacks. Sometimes these drawbacks can be more significant than the benefits and might hinder your development, time-to-market, or your ability to...

Read article
 | Pawel Gerr

This article is the second part of a series about Roslyn Source Generators & co. In the previous article we built a Source Generator that extended a custom class by creating and initializing the new property Items. This new property returns all items of a smart-enum. Although the Source Generator is fully functional, I...

Read article
 | Pawel Gerr

The Roslyn Source Generators, which came with the .NET 5 SDK, are probably one of the best features in the last few years. They allow us to improve the way we share code today by generating C# code on-the-fly during development.

Read article
 | Boris Wilhelms

At least in the .NET space, IdentityServer is a prominent candidate for implementing token-based security in your .NET and ASP.NET applications, server-side or SPAs. After the license change of the popular open-source library, many are wondering if there are any viable alternatives. If you are an existing...

Read article
 | Thorsten Hans

Im Webinar am 08. Juli 2020 erklärte Thorsten Hans was Docker ist, warum Docker für jedes Unternehmen interessant ist und wie .NET-Web-Anwendungen effizient in Docker Containern betrieben werden. Lernen Sie die wichtigsten Charakteristiken und Kommandos, um mit der beliebten…

Read article
 | Boris Wilhelms

Im Webinar am 01. Juli 2020 zeigte Boris Wilhelms, was das Serverless-Modell ist und wie wir als .NET-Entwickler Azure Functions nutzen können um Serverless-Code zu schreiben. Das Serverless-Modell ist eine von vielen verschiedenen Möglichkeiten, Anwendungen für die Cloud zu…

Read article
 | Pawel Gerr

It has been a while since I released my article about the usage of temp tables in Entity Framework (v6). Meanwhile, Microsoft has released a completely rewritten version of its O/R mapper so my old approach is no longer applicable. But before we learn about a new one, let us…

Read article
 | Pawel Gerr

Both a LINQ query and an SQL statement are descriptions that state which data should be fetched, but not how.. Sure, when reading LINQ or SQL, we can make assumptions about the performance but not in every case. Some queries are either too fancy or too big to grasp, so our…

Read article
 | Pawel Gerr

For one of our customers, I recently had to change the target .NET Framework version from 4.5.1 to 4.6.1 because a new version of some important Nuget package requires .NET 4.6.1. Changing the framework version in newer SDK-based projects is not a problem but the old files, the…

Read article
 | Pawel Gerr

After talking about performance issues like N+1 Queries and the Cartesian Explosion that made its comeback in Entity Framework Core 3, we will today look at a performance issue that is not tied to any Entity Framework version but is rather a general one. What do I mean by…

Read article
 | Pawel Gerr

In Entity Framework Core 3.0/3.1 the SQL statement generation underwent significant changes. As we have seen in the previous post these changes removed both the implicit client-side evaluation and the N+1 Query Problem (which is good!). Unfortunately, these changes (re)introduced…

Read article
 | Pawel Gerr

In a previous post we saw that EF 2.1 is highly susceptible to the N+1 queries problem. After the release of a new version of Entity Framework Core (EF) the first question coming to mind is: "Is it still a big issue in EF 3.1?" And if the answer is no, is there anything else we…

Read article
 | Sebastian Gingter

In my last article I explained how the changes in Chrome 80 (February 2020) can break your existing web sites or web applications, because SameSite cookies will be treated differently. In that post I focused on how to correctly set your cookies and how to mitigate…

Read article
 | Sebastian Gingter

First, the good news: In February 2020 Google is going to release Chrome 80. This release will include Google's implementation of 'Incrementally better Cookies', which will make the web a more secure place and helps to ensure better privacy for users. The bad news is that this…

Read article
 | Pawel Gerr

In the previous blog post we used a navigational property to work around the limitations of the extension method . The problem is, there is not always such a property we can use for grouping. Especially, when following domain driven design practices, a bidirectional navigation is…

Read article
 | Pawel Gerr

With Entity Framework Core 3.0 (EF) the internal implementation of the LINQ query translation has been changed a lot. So, some queries that didn't work previously are working now and some that worked are not working anymore. :) The LINQ extension method is a special one…

Read article
 | Pawel Gerr

Whether in an application in production or in integration tests on CI, the deadlocks are virtually unavoidable. The behavior of a deadlock depends on the database (MS SQL Server, MySQL, etc)  and the isolation level (like Snapshot Isolation). Some of the databases are blocking…

Read article
 | Pawel Gerr

In the blog post Entity Framework Core: Use TransactionScope with Caution! we saw a few cases we have to be aware of when using . Here is another one that can lead to an exception when using the new C# 8.0 feature: . First, we look at a code snippet without C# 8.0 feature: Which…

Read article
 | Pawel Gerr

The Entity Framework Core (EF) extension method provides us the ability to load additional data besides the entities we are querying for. For example: loading products along with their translations. In some use cases we want to load all translations for the requested products…

Read article
 | Pawel Gerr

With the introduction of ASP.NET Core 3.0 the default JSON serializer has been changed from Newtonsoft.Json to System.Text.Json. For projects and libraries switching to the new JSON serializer this change means more performance and the opportunity to rewrite our . Serialization…

Read article
 | Pawel Gerr

By switching the to and setting to in the csproj-file we are now benefiting from the introduced with the latest version of C#. By enabling this new feature all type members, input and output parameters are considered to be not-null. If some members or parameters, like can…

Read article
 | Pawel Gerr

In the blog post ROW_NUMBER Support we saw how to implement a custom function and in the previous post Improved Value Conversion Support we realized that inserting and selecting custom types is one thing but using them for filtering is something totally different. Let's take a…

Read article
 | Pawel Gerr

Entity Framework Core (EF) 2.1 introduced a new feature called Value Conversion. Now, we are able to map custom .NET types to a type the database understands and vice versa. This long-awaited feature is especially popular among software engineers following the domain driven…

Read article
 | Pawel Gerr

In the previous post (Custom Functions - using IMethodCallTranslator) we looked at the more flexible approach that requires some boilerplate code. For the usage of a custom function in a project, especially if there are no plans to make the function public then the sacrifice of…

Read article
 | Pawel Gerr

In the previous blog post (Entity Framework Core: ROW_NUMBER Support) we saw how to use the custom function with Entity Framework Core (EF). Now, we will look into the implementation. In the next and the last post of this series we will look ath the 2nd approach that uses the…

Read article
 | Pawel Gerr

There are some use cases that force me to use raw T-SQL instead of using LINQ. One of them is the need for ROW_NUMBER. But not anymore... One again, due to great work of Entity Framework (EF) team we are able to add more capabilities to EF quite easily. At the moment there are…

Read article
 | Pawel Gerr

Motivation One of the main queries in my projects is to select multiple database records having a collection of some kind of identifiers. Most of the time it works very well using the method . The query above is translated by the Entity Framework Core (EF Core) to clause: Most…

Read article
 | Pawel Gerr

When working with Entity Framework Core (EF) a lot of code can be tested using the In-Memory database provider but sometimes you want (or have) to go to the real database. For example, you are using not just LINQ but custom SQL statements due to performance reasons or you want to…

Read article
 | Pawel Gerr

In the first part of this short blog post series we looked at how to change the database schema of a DbContext, now it is all about changing the schema of the EF Core Migrations at runtime. The samples are on Github: PawelGerr/EntityFrameworkCore-Demos Given is a  implementing…

Read article
 | Pawel Gerr

One of the new features of Entity Framework Core 2.1 is the support of TransactionScopes. The usage of a  is very easy, just put a new instance in a , write the code inside the block and when you are finished then call to commit the transaction: But, before changing your code…

Read article
 | Pawel Gerr

At the moment there is no built-in support for changing the database schema at runtime. Luckily, Entity Framework Core (EF) provides us with the right tools to implement it by ourselves. The demos are on GitHub: github:PawelGerr/EntityFrameworkCore-Demos Given are a database…

Read article
 | Pawel Gerr

In the previous post we have created 2 Entity Framework Core (EF Core) models with a code first approach. One model was using the Table-per-Hierarchy (TPH) pattern and the other one Table-per-Type (TPT). In this post we want to approach a more common scenario we see in customer…

Read article
 | Pawel Gerr

With O/R mappers there are a few patterns how a class hierarchy can be mapped to a relational database. The most popular ones are the Table-Per-Hierarchy (TPH) and the Table-Per-Type (TPT) patterns. The Entity Framework Core 2.x (EF Core) officially supports the Table-per…

Read article
 | Pawel Gerr

In the previous post we have identified some Entity Framework (EF) LINQ queries that are affected by so called N+1 queries problem. In the meantime a new version (2.1-RC1) of Entity Framework has been released so we check the SQL statement generation yet another time. Samples…

Read article
 | Pawel Gerr

After working with Entity Framework 6 (EF 6) for several years, a software developer can predict the SQL statements being generated by EF just by looking at the LINQ queries. With Entity Framework Core (EF Core) the SQL statement generation has changed - in some cases for the…

Read article
 | Pawel Gerr

In the previous blog post I talked about how to change the log level at runtime by coupling the (or rather the ) with the . However, the solution has one drawback: you need to change the file  for that. In this post we will be able to change the log level without changing the…

Read article
 | Pawel Gerr

When running the application in production then the log level is set somewhere between and . The question is what to do if you or your customer experiences some undesired behavior and the logs with present log level aren't enough to pinpoint the issue. The first solution that…

Read article
 | Pawel Gerr

If you are using Autofac in your ASP.NET Core application then I recommend to update Autofac to version 4.6.1. This bugfix release brought a change how child scope handle additional registrations so that some errors like just disappear. With additional registrations I mean the…

Read article
 | Pawel Gerr

In the previous post "ASP.NET Core in production: Take back control of your web app" I mentioned that getting hold if the dependency injection (DI) is just one step of many to improve the architecture of your web applications. Today well will look into 2 other aspects that are…

Read article
 | Pawel Gerr

With ASP.NET Core the setup of a new MVC or a Web API project is essentially a 2-liner. The standard setup you can find in most tutorials is ideal for demos, workshops or simple web apps but is insufficient for complex applications. The standard setup looks as follows: The rest…

Read article
 | Pawel Gerr

If you register a type as a singleton then you expect just 1 instance of this type in your whole application. What you may not know is that ASP.NET Core is creating 2 instances of during building of the that may lead to 2 instance of your "singleton". This is the case if you…

Read article
 | Pawel Gerr

After working with the new ASP.NET Core server and the for a while in a number of projects I run into some performance issues. Actually, it was a throughput issue. It took me some time to figure out whether it is the server or the client responsible for the problems. And the…

Read article
 | Pawel Gerr

If you have switched your .NET Core project from to (MSBuild) and updated the nuget packages then you may run into an issue when executing some of the -commands. I got the following error after executing : The problem is that some of my (3rd party) dependencies are using…

Read article
 | Pawel Gerr

Configuration is one of the most prominent cornerstones in software systems, and especially in distributed systems. And it has been a point for discussions in .NET for quite some time. In one of our projects we have built a solution that lets different applications in different…

Read article
 | Pawel Gerr

If you are planing to run an ASP.NET Core application with IIS then this blog post might be worth a glance. These are a few issues I run into ... 1. Targets in .xproj-file If the project started with RC1 or earlier version of .NET Core then check for correct targets. Open the…

Read article
 | Pawel Gerr

After several years of using the same Dependency Injection (DI) framework like Autofac you may have a good understanding how your components, implementing the interface IDisposable, are going to be disposed. With the nuget package Microsoft.Extensions.DependencyInjection the new…

Read article
 | Pawel Gerr

With the introduction of .NET Core we got a framework that works not just on Windows, but on Linux and macOS as well. One of the best parts of .NET Core is that the APIs stayed almost the same compared to the old .NET, meaning developers can use their .NET skills to build cross…

Read article
 | Pawel Gerr

Fetching one record from a collection using navigational properties in Entity Framework may lead to unnecessary JOINs. To show the problem we need two tables Products and Prices. The query shown below is fetching products along with their first price. Looks simple. Lets look at…

Read article
 | Pawel Gerr

Implementing database access with Entity Framework is pretty convenient, but sometimes the query performance can be very poor. Especially using navigational properties to load collections leads to significantly longer execution times and more I/O. To see the impact of the loading…

Read article
 | Pawel Gerr

With the new .NET Core framework and libraries we have got an interface called Microsoft.Extensions.Logging.ILogger to be used for writing log messages. Various 3rd party and built-in components make very good use of it. To see how much is being logged just create a simple Web…

Read article