Disabling thread safety check in Entity Framework
In this blog post we will have a look into how to disable the thread safety check in Entity Framework. What are the implications of doing so and how to do it.
Hey, I'm Steven a .NET Developer in Switzerland. I am a Microsoft MVP. Also, this blog is open source on GitHub.
In this blog post we will have a look into how to disable the thread safety check in Entity Framework. What are the implications of doing so and how to do it.
Architectural Unit tests are nice to constraint your system (like which parts of your application can access other parts of your application). This blog post is not about that - that is covered a lot in the internet. No, I want to show what I did in a recent project: Checking if all controllers do use CancellationToken
and some other entities are sealed
.
Some while ago I was explaining what "Lowering" is. And the interesting part is that List
behaves differently like an array while also a List
is backed by an array. But why?
Last year I wrote an article about how ToListAsync
was slow in Entity Framework titled: "Be careful with ToListAsync and ToArrayAsync in Entity Framework Core". Things have evolved since then, so let's celebrate!
Often times, you find yourself in writing data-driven tests in xUnit (like Theory
tests) and you want to add a description to each test case. Let's explore how to do that.
Did you ever try to have a switch expression in Blazor? Yes, and did it go well? Sometimes not. Let's see why!
As every year, the dotnet team adjusted the runtime and libraries to improve performance. So let's go over some of the highlights. I will link the corresponding blog post or GitHub issue for each item, so you can read more about it if you are interested.
And of course: You will find the benchmarks at the end of the article.
If you want to be up to date with dotnet development, you can obviously follow the official blogs from Microsoft and release notes. But what if you want to pick into the future or smaller details that aren't released or covered? Then let's go to GitHub!
If we have a List<T>
and an IList<T>
, enumerating over the List<T>
is faster than enumerating over the IList<T>
. Why is that?
For good reasons, many folks don't want to use reflection. Since .NET 8, we have a better way of dealing with this in most of the cases (when known in advance). But we can go the opposite: Make it even unsafer for a tiny bit performance!