Latest Articles

Entity Framework
Entity Framework Core 3.0 - "Hidden" GROUP BY Capabilities (Part 2)
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…
Pawel Gerr
Entity Framework
Entity Framework Core 3.0 - "Hidden" GROUP BY Capabilities (Part 1)
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…
Pawel Gerr
Entity Framework
Entity Framework Core - Getting more Deadlock Information with named Transactions
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…
Pawel Gerr
Entity Framework
Entity Framework Core - Beware of Lifetime Extension of TransactionScopes using C# 8.0
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…
Pawel Gerr
ASP.NET
ASP.NET Core 3.0 - Custom JsonConverter for the new System.Text.Json
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…
Pawel Gerr
.NET
C# 8 - Nullable Reference Types in .NET Standard < 2.1 and .NET 4.x
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…
Pawel Gerr
Entity Framework
Entity Framework Core - Making RowNumber (more) useful
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…
Pawel Gerr
Entity Framework
Entity Framework Core - Improved Value Conversion Support
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…
Pawel Gerr
Entity Framework
Entity Framework Core - Custom Functions (using HasDbFunction)
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…
Pawel Gerr
Entity Framework
Entity Framework Core - Custom Functions (using IMethodCallTranslator)
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…
Pawel Gerr
Entity Framework
Entity Framework Core - ROW_NUMBER Support
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…
Pawel Gerr
Entity Framework
Entity Framework Core - Contains Check via Temp Tables
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…
Pawel Gerr