Explain the new changes in. NET Core 3.0

Time:2019-9-10

NET Core 3.0 is the next major version of the. NET Core platform. This article reviews the history of. Net Core and shows how it evolved from version 1, which basically supports Web and data workloads, to version 3.0, which can run Web, desktop, machine learning, container, IoT, etc.

.NET Core 1

The history of. NET Core dates back several years. Version 1 was launched in 2016 to generate. NET for the first edition of open source and cross-platform (Windows, macOS and Linux). The inspiration comes from customers who can only use open source frameworks, as well as other clients who need to run. NET applications on Linux servers. Because. NET Core is cross-platform, it is designed to use the command line to complete all operations without IDE. To meet the compatibility challenge of the globally installed. NET Framework, it has designed parallel support, including the framework attached as part of the application, so that the application will not rely on any framework installed on the computer. Version 1 is accompanied by a new version of ASP.NET, Entity Framework (EF), and the main targeted Web applications.

.NET Core 2

Although version 1 supports running. NET on a new platform, it only supports a limited set of. NET APIs. To solve this problem, we created. NET Standard, which specifies the API that any. NET runtime must implement, so that code and binary files can be shared across. NET platforms and versions. In. NET Standard 2.0, we added more than 20,000 APIs to the. NET Standard specification. The. NET Core version 2 was released in June 2017 and supports. NET Standard 2.0 to give it access to these APIs. We also introduced the Windows Compatibility Package, which contains many uGet packages that contain only Windows APIs (such as System. Drawing, System. Directory Services, etc.). ASP.NET Core 2.0 introduces two frameworks missing in. NET Core 1.0, Razor Pages and SignalR. Entity Framework Core began to support delayed loading, a popular Entity Framework feature. NET Core 2 is also pushing. NET to become one of the fastest complete stack frameworks. The TechEmpower benchmark, run by an independent company, ranked. NET Core seventh in the original pure text performance field and sixth in the Web and data performance Fortunes test, beating Java servlets and Node.js (bit.ly/2PEE1l1).

.NET Core 3.0

NET Core 3.0 is the next major version of the. NET Core platform. It adds many exciting features, such as support for Windows desktop applications using Windows Forms, Windows Presentation Foundation (WPF) and Entity Framework 6. For Web development, it began to support the use of C # to generate client-side Web applications through Razor components (formerly known as Blazor). In addition, it supports C 8.0 and. NET Standard 2.1.

We are adding support for the Internet of Things (IoT) solution in. NET Core 3.0. Hardware pins (used to control devices and read sensor data) can now be programmed on Raspberry Pi and similar devices, and communicate through serial ports on all supported OSs (for example, using Raspberry Pi or Arduino). We also added IoT device support for ARM64 to complement the existing ARM32 function.

NET Core 3.0 will also fully support ML. NET, an open source machine learning framework for. NET developers. ML.NET strongly drives Azure machine learning, Windows Defender and PowerPoint Design Ideas. With ML. NET, many common machine learning schemes can be added to applications, such as emotional analysis, suggestions, prediction, image classification, etc. For more information, visit bit.ly/2OLRGRQ.

We recently released the first preview of. NET Core 3.0. To learn more about. NET Core 3.0 and trial preview, visit aka.ms/netcore 3 Preview 1.

Desktop (WinForms and WPF) and Open Source Code

WinForms and WPF are two of the most commonly used. NET application types and are used by millions of developers. NET Core 3.0 began to support Windows and WPF, and introduced. NET Core to Windows desktop development. NET Core has always been open source, and both frameworks in GitHub are open source, just like the rest.NET Core. For the first time in history, customers will be able to witness the open development of these frameworks, even by asking questions, fixing bugs, or helping develop new functions in real time in GitHub. WinUI XAML libraries will also be open source. Through XAML Islands, these controls can be used in WinForms and WPF applications.

Many existing WinForms and WPF applications use entity frameworks to access data, so. NET Core also supports entity frameworks 6.

You may want to know why desktop applications are generated on. NET Core. It’s simple: This will benefit from all the enhancements in. NET Core. Not only can you generate applications on the latest version of the framework without installing. NET Core, but you can also publish applications and. NET Core to an. EXE. NET Core is designed with parallel support in mind, so it can install multiple versions on a single computer and lock the application to the target version at design time. In addition, given this parallel nature, APIs in. NET Core (including WinForms and WPF) can be improved without the risk of application corruption.

ASP.NET Core 3

However,. NET Core 3.0 is not all desktop related. There are many exciting new features designed for the Web. Next, we will introduce some of the functions we are developing.

One question customers often ask is how to get an RPC experience in. NET Core (as in. NET remote and Windows Communication Foundation). We are participating in the gRPC (grpc.io) project to ensure that gRPC can provide first-class support for. NET developers.

Earlier this year, we started an experiment with. NET (we call it Blazor) for client-side Web development. With Blazor, you can write Web UI components that run directly in the browser’s. NET runtime based on Web Assembly without writing a single line of JavaScript. Components are created using Razor grammar, which are compiled with code into regular. NET assemblies. Then, assemblies and Web Assembly-based. NET runtimes are downloaded into browsers and executed using open Web standards only (without any plug-ins or code conversions), as shown in Figure 1.

Figure 1: Client Web development using Blazor

NET Core can also be used to run the same components on the server, where all UI interactions and DOM updates are processed through SignalR connections, as shown in Figure 2. After execution, the component tracks the updates required by the DOM and sends the updates to the browser through the SignalR connection. UI events are sent to the server using the same connection. This model has several advantages: smaller download size, code centralization on the server, and benefits from all the functional and performance advantages of running components on. NET Core.

Figure 2: Using SignalR to run UI Web components on the server

For. NET Core 3.0, we will integrate Blazor component model into ASP. NET Core. We call this integrated component model “Razor component”. Razor components have ushered in a new era of composable UI using ASP. NET Core and full stack Web development using. NET. For. NET Core 3.0, Razor components were originally run on servers as independent routable components, or through components used by Razor Pages and views. However, the same component can also be run on the Web Assembly client side. While developing. NET Core 3.0, we will continue to work on supporting the use of interpreter-based. NET runtime to run Razor components on Web Assembly, which is expected to be available in subsequent versions. Later, we plan to release full pre-compiled support for. NET code to Web Assembly, which will significantly improve runtime performance.

EF Core 3.0

LINQ is a user’s favorite. NET function. It is easy to write database queries without leaving the language of choice. It can also use rich type information to obtain IntelliSense and type checking when compiling. However, LINQ also supports writing an almost unlimited number of complex queries, which has always been a huge challenge for LINQ providers. The EF Core part solves this problem by supporting the selection of query parts that can be converted to SQL, and then executing the remaining queries in memory. In some cases, this is desirable, but in many other cases, it can lead to very inefficient queries that are not discovered until the application is put into production.

In EF Core 3.0, we plan to change the working principle and testing method of LINQ implementation in depth to improve its reliability (for example, to avoid damaging queries in patch versions); to enable it to correctly convert more expressions into SQL; to generate more efficient queries in more cases; and to prevent LINQ from being put into production. Very inefficient queries detected appear.

We have been working on developing Cosmos DB providers for EF Core so that developers can familiarize themselves with the EF programming model and easily target Azure Cosmos DB as an application database. The goal is to take advantage of some of Cosmos DB’s advantages, such as global distribution, “always on” availability, resilient scalability and low latency, and even make it easier for. NET developers to access it. This provider will enable most EF Core functions for the SQL API in Cosmos DB, such as automatic change tracking, LINQ, and value conversion.

Other features we plan to add to EF Core 3.0 include attribute package entities (entities that store data in index attributes rather than regular attributes); the ability to reverse-engineer database views as query types; and integration with new C# 8.0 functions, such as IAsync Enumerable < T > support and null citation. Use type.

We understand that porting to EF Core is a huge workload for many existing applications that use older versions of EF. Because of this, we also transplanted EF 6 so that we could use. NET Core.

.NET Standard 2.1

If you follow. NET Standard, you can create libraries for all. NET implementations, not only for. NET Core, but also for Xamarin and Unity. In. NET Standard 1. x, we only model APIs that are commonly used across various implementations. In. NET Standard 2.0, we focus on simplifying the process of porting existing. NET Framework code to. NET Core, which brings not only an additional 20,000 APIs, but also compatibility patterns (easy to reference. NET Framework libraries from. NET Standard-based libraries without recompiling them). For both versions of the standard, there are hardly any new components, because all APIs are existing. NET APIs.

In. NET Standard 2.1, this has changed: we added about 3,000 almost new APIs, which were introduced as part of. NET Core open source development. By adding them to standards, we introduce them into all. NET Standard implementations.

These new APIs include:

Span<T>: In. NET Core 2.1, we added Span<T> which is an array-like type that allows for uniform representation of managed and unmanaged memory and supports slicing without replication. Span < T > is the core of performance-related improvements in. NET Core 2.1. Because it allows for more efficient buffer management, it can help reduce allocation and replication. To learn more about this type, be sure to read Stephen Toub’s excellent article on Span <T> (msdn.com/magazine/mt814808).

ValueTask and ValueTask <T>: In. NET Core 2.1, the most important function-related improvements in basic content support high-performance solutions (bit.ly/2HfIXob) and make async/await more efficient. ValueTask < T > already exists, which facilitates the return of results when the operation is synchronized, without the need to allocate a new Task < T >. In. NET Core 2.1, we further improved this functionality and increased its usability to have a corresponding non-generic ValueTask to reduce allocation when operations have to be done asynchronously, which is currently used by Socket and NetworkStream types.

Conventional utility API: Because. NET Core is open source, we add many small functions across base class libraries, such as System. HashCode for merging hash code, or new overloads on System. String. There are about 800 new members in. NET Core, almost all of which have been added to. NET Standard 2.1.

For more details, see the. NET Standard 2.1 bulletin (bit.ly/2RCW2fX).

C# 8.0

C# 8.0 is the next version of C#, which improves the language in several main aspects. Reference types for null help prevent null reference exceptions and improve null security coding practices. Optionally, you can enable the following functionality: you see warnings when assigning null to variables or parameters of a type string (for example). To be null, you must use “string?” as the reference type for null.

The operation of asynchronous flow to asynchronous data flow is the operation of async/await to single asynchronous result. The new framework type IAsyncEnumerable < T > is an asynchronous version of IEnumerable < T > and can also perform foreach and yield return:


public static async IAsyncEnumerable<T> FilterAsync<T>(
 this IAsyncEnumerable<T> source,
 Func<T, Task<bool>> predicate)
{
 await foreach (T element in source)
 {
  if (await predicate(element)) yield return element;
 }
}

In addition to other functions, the interface can be implemented by default interface members to add new members without interrupting existing implementers. Switch expression ensures that pattern matching is more concise, not only recursive patterns, but also deep mining patterns into test values. For more details on C# 8.0, please visit aka.ms/csharp8.

How will the. NET Framework and. NET Core develop?

The. NET Framework is implemented in. NET installed on more than 1 billion computers, so compatibility needs to be maintained as much as possible. Therefore, its update speed is slower than. NET Core. Even security fixes and bug fixes can cause applications to interrupt because applications rely on old behavior. We will ensure that the. NET Framework always supports the latest network protocols, security standards and Windows functionality.

NET Core is an open source, cross-platform and rapidly updated version of. NET. Given this parallel nature, we can apply it without risking changes to the. NET Framework application. That is to say, over time. NET Core will add new APIs and language features, while. NET Framework will not.

If existing. NET Framework applications do not require any. NET Core functionality, there should be no pressure to migrate to. NET Core. Both. NET Framework and. NET Core will be fully supported; the. NET Framework is always part of Windows. Even within Microsoft, we have many large product lines based on the. NET Framework and will always be based on the. NET Framework. But looking ahead, the functions of. NET Core and. NET Framework will be different.

summary

NET Core 3.0 is expected to be released in the second half of 2019. It will provide open source versions of WinForms and WPF for Windows desktop development. Entity Framework 6 will also be included. In addition, important updates will be made to ASP.NET Core, Entity Framework Core,. NET Standard and C#. For new. NET applications, serious consideration should be given to using this version of. NET Core. For more information, please visit aka.ms/netcore 3preview 1.

We look forward to the future of. NET and will add more workloads to. NET Core. We recommend that you try. NET Core 3.0 preview and send us feedback.

Original address: What’s Coming in. NET Core 3.0

Author: Scott Hunter

The above is the whole content of this article. I hope it will be helpful to everyone’s study, and I hope you will support developpaer more.