Sponsor: Do you build complex software systems? See how NServiceBus makes it easier to design, build, and manage software systems that use message queues to achieve loose coupling. Get started for free.
Here are the things that caught my eye recently in .NET. I’d love to hear what you found most interesting this week. Let me know in the comments or on Twitter.
How to migrate from Newtonsoft.Json to System.Text.Json
This article shows how to migrate from Newtonsoft.Json to System.Text.Json.
System.Text.Json
focuses primarily on performance, security, and standards compliance. It has some key differences in default behavior and doesn’t aim to have feature parity withNewtonsoft.Json
. For some scenarios,System.Text.Json
has no built-in functionality, but there are recommended workarounds. For other scenarios, workarounds are impractical. If your application depends on a missing feature, consider filing an issue to find out if support for your scenario can be added.
Endpoint Debugging in ASP.NET Core 3 Applications
Nothing can be more frustrating than going into a situation “thinking” you know how a framework works, only to spend the next several hours pulling your hair out and stewing in a pot of unhealthy feelings. I like to consider myself an ASP.NET routing expert with my experience dating back to MVC 1.0. Recently, I’ve started using ASP.NET Core Razor Pages mixed in with MVC and API approaches. I find the combination of all this technology to be a winning one, but it can also add complexity when building views. In this post, I’ll show you a simple one page Razor Page that can help diagnose route resolution issues quickly. Quickly see what your ASP.NET Core application sees and what it requires to resolve routes.
Link: https://khalidabuhakmeh.com/endpoint-debugging-in-asp-dot-net-core-3-applications
Introducing EF Core 5 Features: Using ToQueryString to get generated SQL
EF Core 5.0 introduces the
ToQueryString
extension method which will return the SQL generated by EF Core when executing a LINQ query.
Link: https://blog.oneunicorn.com/2020/01/12/toquerystring/
CreateDbCommand: I’ll see your string and raise you a command…
Instead, EF Core 5.0 introduces
CreateDbCommand
which creates and configures aDbCommand
just as EF does to execute the query.
Link: https://blog.oneunicorn.com/2020/01/15/createdbcommand/