BT

Facilitating the spread of knowledge and innovation in professional software development

Contribute

Topics

Choose your language

InfoQ Homepage News ASP.NET Core Improvements in .NET 5

ASP.NET Core Improvements in .NET 5

This item in japanese

Bookmarks

At the .NET Conf 2020 in November, Microsoft released the .NET 5 platform. This release's massive investment focuses primarily on improving the entire platform’s overall performance, followed by a broad set of new features in ASP.NET Core, mainly related to Blazor, SignalR, and Web API. Meanwhile, ASP.NET MVC adds support to more model binding types and a new library, the Microsoft.Web.Identity, which simplifies the Azure Active Directory authentication integration.

ASP.NET Core, which is further improved with .NET 5, is one of the most performing frameworks according to TechEmpower benchmarks and has got a great response from the developers’ community. The first example of enhancement is in the garbage collection, where now threads can increase the work done during the object collection or reduce the lock contention when statics are scanned. Another example is the better quality of the machine code generated by the just-in-time compiler (JIT), thanks to new features such as removing the redundant zero init or bound checks on indexes of arrays, strings, and spans. As a consequence of the increased performance in GC e JIT, other areas such as the allocation in the Kestrel server or the gRPC implementation for .NET got better too.


Source: gRPC performance improvements in .NET 5 | ASP.NET Blog

Other useful improvements are:

In the Blazor framework, the performance got better both in the WebAssembly runtime, where the processing times for common operations are cut in half and the UI components rendering phase. New controls such as InputFile, InputRadio, and InputRadioGroup are available, and the component virtualization enhances the rendering process.


Source: ASP.NET Core updates in .NET 5 Release Candidate 1 | ASP.NET Blog

About SignalR, now developers can manage parallel hub method invocations at a time and use SignalR Hub filters, which allows writing code that runs before and after Hub methods are called, facilitating logging, error handling, and argument validation. Filters can be configured per hub or globally.

In the ASP.NET Core MVC framework, the model binding now supports the record type introduced in C# 9. Also, requests containing a UTC time string can be bound to a UTC DateTime field:

public record Person([Required] string Name, [Range(0, 150)] int Age);

public class PersonController
{
   public IActionResult Index() => View();

   [HttpPost]
   public IActionResult Index(Person person)
   {
          // ...
   }
}

Source: What's new in ASP.NET Core 5.0 | Microsoft Docs

The .NET 5 release also brings innovation to the OpenAPI support, which is now enabled by default. Thanks to the partnership with the maintainer of the Swashbuckle.AspNetCore project, the web API project template includes the NuGet package for Swashbuckle. The OpenAPI configuration resides in the Startup class’s ConfigureServices method and is enabled by default only in the development mode, along with the Swagger UI page.

The latest improvements are related to the authentication in the ASP.NET Core application: the project template references Microsoft.Identity.Web NuGet library, facilitating the authentication process through Azure Active Directory and the ability to access Azure resources on behalf of a specific user.

Finally, the developers can use the dotnet watch command to launch both the debugger and the browser. During the debugging, each change applied to the code automatically refreshes the page.

With all these features and improvements, as Scott Hunter (director program management, .NET) stated during many occasions, Microsoft has a strong commitment to the framework alongside the community contribution to laying the foundation for the next version of .NET, usually referred to as the One .NET, which is planned for November 2021.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT