Microsoft announced the new .NET 5 (future of .NET) at the Build 2019 conference. .NET 5 will be the single unified platform for building applications that runs on all platforms(Windows, Linux) and devices (IoT, Mobile).
Microsoft named this new release .NET 5.0 instead of .NET Core 4.0 for two reasons:
- Skipped version numbers 4.x to avoid confusion with .NET Framework 4.x.
- Dropped "Core" from the name to emphasize that this is the main implementation of .NET going forward. .NET 5.0 supports more types of apps and more platforms than .NET Core or .NET Framework.
ASP.NET Core 5.0 is based on .NET 5.0 but retains the name "Core" to avoid confusing it with ASP.NET MVC 5. Likewise, Entity Framework Core 5.0 retains the name "Core" to avoid confusing it with Entity Framework 5 and 6.
C# updates
Developers writing .NET 5 apps will have access to the latest C# version and features. .NET 5 is paired with C# 9, which brings many new features to the language. Here are a few highlights:
- Records: Immutable reference types that behave like value types, and introduce the new with keyword into the language.
- Relational pattern matching: Extends pattern matching capabilities to relational operators for comparative evaluations and expressions, including logical patterns - new keywords and, or, and not.
- Top-level statements: As a means for accelerating adoption and learning of C#, the Main method can be omitted and application as simple as the following is valid:
System.Console.Write("Hello world!");
- Function pointers: Language constructs that expose the following intermediate language (IL) opcodes: ldftn and calli.
ASP.NET Web Forms
ASP.NET Web Forms will not be coming to .NET 5 and Microsoft is currently recommending a move to Blazor which was an experimental project that's recently been promoted to official. The other alternatives are Angular, React, and Vue SPA frameworks if you are good at JavaScript.
If you are currently using ASP.NET MVC as a full stack web app, you can continue to use the same stack by using ASP.NET Core MVC or the new Razor Pages introduced in .NET Core 2.0, which may look similar to ASP.NET web forms for quickly building web form applications without views and controllers. However, if you are developing modern web applications for enterprises, its better to consider single page applications such as Blazor, Angular, or React instead of a traditional web app for providing rich client-side functionality.
WCF (Windows Communication Foundation)
The announcement that WCF is going to miss the .NET 5 train surprised many, including me. There has been a lot of discussion on GitHub of bringing back WCF into .NET Core, but Microsoft decided not to do so because their initial estimation for porting WCF into .NET Core was three years. (Source: DotNetRocks Podcast)
Microsoft is recommending the use of gRPC as an alternative which is a modern, open-source, high-performance RPC framework that can run in any environment. However, unlike WCF, gRPC cannot be hosted in IIS as of today, because of HTTP/2 implementation of Http.Sys does not support HTTP response trailing headers which gRPC relies on.
What’s Been Replaced
EF Core - Entity Framework Core is replacing EF 6 in the .NET Core Framework.
ASP.NET Core - ASP.NET is replaced by ASP.NET Core. Check the migration guide for porting ASP.NET applications into ASP.NET Core.
ASP.NET Core MVC - ASP.NET Core MVC unified ASP.NET MVC and Web API. Check the migration guide for porting asp.net mvc app into ASP.NET MVC.
MSIX - Microsoft's new packaging tool which replaces the old MSI package installer for desktop applications.
JsonDocument - The new Json Document library from the System.Text.Json.JsonDocument API will replace json.net. It is 2-3 times faster than the old json.net.
Summary
At the end of this article, you have a high-level idea of how .NET 5 will impact your existing .NET projects and which opportunities the new platform is going to offer you. Maybe these highlighted five things may seem like little stuff, but they should allow you to find your way around this turning point in the .NET evolution.
No comments:
Post a Comment