DOT NET PLATFORM

.NET Platform

.NET ARCHITECTURE

Here is the block diagram of the .NET architecture, valid before the November release of DOT NET 5. Underneath it all is the .NET Standard which is a set of APIs (Application Program Interface) that defines which services and what rules must be performed by each concrete implementation of the software platform that wants to conform to these specifications.

.NET STANDARD

The first implementation of the .NET standard, which is installed with the .NET Core SDK, was the .NET Framework on the market since 2002 and which is used to create desktop, web and mobile applications, but only and exclusively for the windows environment. . Currently the version of the .NET framework is stopped at 4.8 and with the advent of .NET 5 there will be no further developments. As you can see from the image above, the programs written with the .NET framework are executed by the CLR (Common Language Runtime) that is the virtual machine on which the programs are run. Above the CLR we find a large library of FCL classes (Framework Class Library).

.NET CORE IS A MULTI-PLATFORM APPLICATION

.NET Core is an open source and cross-platform implementation of the .NET Standard. The most important thing to say is that Microsoft with .NET Core has eliminated any dependence on Windows so it is cross-platform, a program written with .NET Core can run indifferently on Windows, Linux, Mac. To learn how to program in C # we will rely on this framework in particular referring to version 3.1 now merged into .NET 5 as we will see later.

.NET CORE ARCHITECTURE

NET Core has its own CLR and its own very large class library including primitive types such as Boolean, Integer, Stringe cc. You will be able to follow the course both on Windows and on Linux and macOS. Xamarin Mono the latest framework acquired by Microsoft which is based on standard .NET is basically used for the development of mobile applications. It has its own Runtime like .NET Core and its own class library. Unity is also based on the Mono project and is used for the development of 2D and 3D games.

ASP NET CORE

THE CORE CLR

Coreclr

The source code produced by the C# language is compiled. The Roslyn compiler takes the source code written with an editor such as Visual Studio Code and after the appropriate checks it does not produce the native code but the CIL (Common Intermediate Language or simply IL Intermediate Language).

INTERMEDIATE LANGUAGE

CIL is independent of the language we used to produce it, it is at this stage that interoperability between the various languages of the .NET platform occurs. At this point the CIL can be run by the CoreCLR. The CoreCLR uses an internal JIT (Just in Time) compiler run at Runtime that takes the CIL in hand and compiles it definitively, that is, for a particular microprocessor and operating system (Windows, Linux, macOS).

Build

ASSEMBLY .NET

Generally speaking, a C# program that is compiled is called an Assembly. The assembly is a file that can have an .exe or .dll extension. The following figure illustrates that we can have two types of assemblies, Process Assemblies and Library Assemblies.

Assembly

THE FUTURE OF DOT NET 5

Microsoft’s goal is to unify the platforms for all .NET developers, for example those who use ASP NET Core and those who develop on the traditional framework to create Desktop applications or for those who are using Xamarin for IOS or Android applications. This ambitious goal failed to materialize in .NET 5 due to the pandemic. This unification will likely occur next November with the release of .NET 6. But let’s see what has been done in .NET 5. Windows Desktop applications and ASP.NET Core web applications can use the new .NET 5 framework and hence its entire Base Class Library. These applications will run thanks to the CoreClr Runtime, a layer placed between .NET 5 and the Operating System that hosts it Windows, Linux, macOS.

BLAZOR

Another type of application is Blazor which does not run on a particular operating system, but its host platform is the Browser. Thanks to a Blazor WebAssembly project, you can run a project written in C # directly in the Browser, to create dynamic web interfaces instead of using JavaScript. This type of project can also use .NET 5 but not the CoreCLR Runtime but in its place there is the Mono Runtime.

.NET 5 architecture

It was decided to use Mono Runtime because those who use the Browser as a host platform cannot have a dependence on the CoreCLR Runtime which is very large in terms of MByte forcing them to download a very full-bodied package, page load times would suffer. A similar argument can be made for Mobile applications, in this case .NET 5 cannot be used as a target Framework but MonoAndroid which in turn will use Mono Runtime.

TimeLine

.NET 5 is a Current version so it will not enjoy the extended support of the LTS versions, only the equal versions higher than .NET 5 will have Long Term Support. The unification process started last year with the release of .NET Core 3.1 in which windows applications could use this target Framework on .NET 5 another piece was added, that is the development of Windows applications but on ARM 64 architecture ARM architecture is used in smaller devices such as smartphones, tablets and this is because it is a type of processor that offers good performance with good energy savings. ARM 64 will be the future of notebooks but also of desktop computers and will supplant the traditional Intel 386 architecture. A series of processors have been created, the latest is SQ2 which is installed on Surface Pro X laptops. At the same time, Apple has also created the its M1 processor however .NET 5 does not support macOS on ARM 64, this means that applications written in .NET 5 on this processor will be slower because they will run in emulation mode. Xamarin is also thought to be unified with the .NET 5 framework with .NET 6.

NEWS INTRODUCED WITH .NET 5

.NET 5 News

ENTITY FRAMEWORK CORE 5

In this release, Entity Framework Core is further improved because Microsoft has solved some performance problems encountered with the previous version 3. Now the product is even more mature and also fills the previous gaps: for example, it allows us to map many-to-relationships. lot of. Other improvements give us more visibility on the SQL queries produced by Entity Framework Core:

  • LINQ queries (ie objects of type IQueryable) now have a ToQueryString() method that allows us to inspect the SQL query before it is even sent to the database;

ASP.NET CORE ON .NET 5

The improvements particularly affected the youngest product of the ASP.NET Core family, namely Blazor WebAssembly, so that it could rival other frontend frameworks, both in functionality and in performance. For the rest, ASP.NET Core has proved to be an already mature product and therefore no new striking features have been introduced. There are however numerous nice-to-haves worth mentioning, such as:

  • Model binding supports C# 9 records, so we can model immutable input models;
  • Performance improvements for Kestrel and gRPC, which are now able to receive more requests per unit of time;
  • Live reload integrated when launching the application with dotnet watch;
  • Leaner docker images when deploying your application to containers.

.NET 5 LINKS TO PREVIOUS POST

.NET 5 IN-DEPTH