.NET 7 | Everything You NEED to Know
We will go through what’s new and hot in .NET 7. I know you’re a busy developer, and keeping up with what is happening is hard. That’s why I am telling you everything you need to know.
Don’t expect any deep dives here. At the end of the video, you should know what’s coming with .NET 7 and whether upgrading to .NET 7 makes sense for you or your team.
Let’s start with general .NET 7 topics before we look at framework-specific topics such as Entity Framework, ASP.NET Core, .NET MAUI, and more.
.NET 7
.NET 7 is the fastest .NET yet. There are more than a thousand performance-impacting changes in .NET 7, including reflection, start-up time, and much more. Microsoft released a 250-page blog post, the size of a book, about performance improvements in .NET 7. There are also noticeable performance improvements for Arm64 devices.
If you want to spend less money on your application running in the cloud or reduce the resources required to run your .NET application on-premise, updating to .NET 7 could be a game changer.
.NET 7 is a short-term support release. There will be 18 months of free support and patches. If you update to .NET 7, you are supposed to update to .NET 8 no later than six months after its release, or around May 2024.
There are a few breaking changes in .NET 7. You can find a link to an article featuring around 50 breaking changes at the time of this recording.
Another noteworthy change is around System.Text.Json. With .NET 7, contract customization gives us more control over serialization and supports additional use cases, including required member support, a new feature of C# 11. There are also a lot of performance improvements and improved extensibility.
Read more: Announcing .NET 7 Release Candidate 1 - .NET Blog (microsoft.com) Announcing .NET 7 Release Candidate 2 - .NET Blog (microsoft.com)
C# 11
C# 11 is the latest version of C# and is available with .NET 7. Since the release schedule was adapted to the yearly release schedule of the .NET platform, the number of changes isn’t that many. However, at least 15 notable new features made it into C# 11.
The most notable would be File-scoped types, generic math support, UTF-8 string literals, raw string literals, required members, and generic attributes.
I’ll definitely look at the new C# 11 features in another video or article. Let me know in the comments what features are most interesting to you. You can also find a link to the blog post with all new C# 11 features.
ASP.NET Core 7
There is a huge list of improvements for ASP.NET Core. For example, an improved debugging experience in Blazor WebAssembly and enhanced tooling support. Blazor WebAssembly and .NET / JavaScript interop have improved a lot. There is even a new low-level .NET / JavaScript interop without any dependency on the Blazor UI component model.
The NavigationManager now supports a method to handle location-changing events, such as leaving a page. It conveniently allows us to warn the user of unsaved work before leaving a page.
The rate-limiting middleware has improved as well. There is an EnableRateLimitingAttribute that allows rate limiting on an endpoint.
While many improvements seem to be targeting Blazor WebAssembly, other areas also have improved. For example, we can now use dependency injection in SignalR hubs or add a description and summary to minimal APIs allowing us to generate better OpenAPI specifications.
Read more: ASP.NET Core updates in .NET 7 Release Candidate 1 - .NET Blog (microsoft.com) ASP.NET Core updates in .NET 7 Release Candidate 2 - .NET Blog (microsoft.com)
.NET MAUI
.NET MAUI is the successor of Xamarin and was originally planned to ship with .NET 6 but was postponed a few months until it was released on May 23rd, 2022.
.NET MAUI provides a single project that handles multi-targeting across devices such as Android and iOS smartphones and tablets, as well as Windows and macOS desktop applications.
For those who haven’t tried .NET MAUI yet, give it a try with .NET 7. The tooling and performance have improved compared to the initial release in May 2022.
Get the .NET MAUI - Enterprise Application Patterns ebook for FREE.
Read more: .NET MAUI in .NET 7 Release Candidate 1 - .NET Blog (microsoft.com) Announcing .NET MAUI support for .NET 7 Release Candidate 2 (microsoft.com)
Entity Framework Core 7
Entity Framework Core 7 comes with performance improvements and newly added interceptors that allow modification and/or suppression of EF Core operations. This includes low-level operations, such as executing a command, and higher-level operations, such as a call to SaveChanges.
Mapping to JSON columns allows us to query, filter, and sort JSON content with EF Core 7. We also get new ExecuteUpdate and ExecuteDelete methods that allow us to bulk update database rows without loading them into memory first. EF Core 7 also comes with better support for value objects when using domain-driven design.
We also get more customization options for the model-building conventions and added support for stored procedures for inserts, updates, and deletes.
We also get better control and T4 templating support for model generation in database-first projects.
Last but not least, we get many query improvements, for example, a better translation of GroupBy and GroupJoin LINQ queries and other general performance improvements.
Read more: Plan for Entity Framework Core 7.0 | Microsoft Learn Announcing Entity Framework 7 Release Candidate 1 - .NET Blog (microsoft.com)
Console.ReadKey (Linux)
Key combinations and modifier keys have been frustrating for .NET developers and users on Linux. Console.ReadKey was one of the methods affected by commonly reported issues.
With .NET 7, all known bugs related to keys pressed in Console.ReadKey calls on Linux have been resolved.
.NET on Windows Package Manager
The Windows Package Manager (winget) now supports installing, uninstalling, and updating .NET from a command prompt or PowerShell.
I’m completely honest and don’t think I would use it to install .NET as a developer. However, dealing with client-side installation could become a lot simpler when installing and updating .NET is scriptable using winget.
Conclusion
Of course, .NET is a huge platform, and there is much more than I could cover in a short article or video like this. Also, I selected the topics based on what I believe are the most important areas that impact the most developers.
For me, the performance improvements and added features for ASP.NET Core and Entity Framework Core make it worth updating to .NET 7 as soon as possible. Let me know if this article or video helped you make the decision for your project. Are you going to update to .NET 7 or wait for .NET 8?
If there is something breathtaking coming with .NET 7 I should have covered, please let me and others know in the comments below this article or video. And if you happen to be here the day it comes out, make sure to check out the .NET Conf 2022 starting on November 8th when .NET 7 will be released.
Thanks for reading; feel free to check out my YouTube channel.