.NET 7 Core features

Subha
5 min readSep 24, 2022

--

.NET MAUI

.NET Multi-platform App UI (MAUI) unifies Android, iOS, macOS, and Windows APIs into a single API so you can write one app that runs natively on many platforms. .NET MAUI enables you to deliver the best app experiences designed specifically by each platform (Android, iOS, macOS, Windows, and Tizen) while enabling you to craft consistent brand experience through rich styling and graphics. Out of the box, each platform looks and behaves the way it should without any additional widgets or styling required.

As part of .NET 7, .NET MAUI provides a single project that handles multi-targeting across devices and their platforms. To learn more about the productivity improvements, tooling, and performance enhancements check out these resources:

ARM64

ARM provides a small form factor with exceptional performance and high-power efficiency.

.NET helps you build applications to run on ARM devices. It considers the below points.

  • It should represent a real-world code that any .NET developer will write for their software.
  • It should be easy to execute and gather measurements with minimal prerequisite steps.
  • Lastly, it should be executable for all the platforms on which we are interested in conducting performance measurements.

Performance

.NET is fast. .NET 7 is the fastest .NET yet. Over a thousand performance-impacting improvements went into .NET 7 impacting reflection, On Stack Replacement (OSR), start-up time, Native AOT, loop optimizations, and many other areas.

For more information on why .NET 7 is the fastest version yet, check out these resources:

The question of how much faster is slippery. A big speed-up in some corner of the .NET just-in-time (JIT) compiler, for example, might make little difference to most applications but a big difference for code that happens to stress that part of its functionality. One of the things Toub discusses is bounds-check elimination, meaning cases where the compiler can maintain memory safety but improve performance by skipping checks for accessing memory out of the bounds of a data structure, by proving that a check is unnecessary. A performance test showed a four-times speed-up in some array operations.

Another eye-catching example is a speeding performance by vectorizing data, where Toub shows example code that gives a 24x speed-up. .NET 7 has added “a very large set of cross-platform operations” based on generic Vector types, which enable this.

Minimal APIs overview

Minimal APIs are architected to create HTTP APIs with minimal dependencies. They are ideal for microservices and apps that want to include only the minimum files, features, and dependencies in ASP.NET Core.

.NET Hot Reload support for ASP.NET Core

.NET Hot Reload applies code changes, including changes to stylesheets, to a running app without restarting the app and without losing the app state. Hot Reload is supported for all ASP.NET Core 6.0 and later projects.

Generally, updated code is rerun to take effect with the following conditions:

· Some startup logic is only run once:

o Middleware, unless the code update is to an inline middleware delegate.

o Configured services.

o Route creation and configuration, unless the code update is to a route handler delegate (for example, OnInitialized).

· In Blazor apps, the framework triggers a Razor component render automatically.

· In MVC and Razor Pages apps, Hot Reload triggers a browser refresh automatically.

· Removing a Razor component parameter attribute doesn’t cause the component to re-render. The app must be restarted.

ASP.NET Core security topics

ASP.NET Core enables developers to configure and manage security. The following list provides links to security topics:

· Authentication

· Authorization

· Data protection

· HTTPS enforcement

· Safe storage of app secrets in development

· XSRF/CSRF prevention

· Cross-Origin Resource Sharing (CORS)

· Cross-Site Scripting (XSS) attacks

Authentication is the process of determining a user’s identity. Authorization is the process of determining whether a user has access to a resource. In ASP.NET Core, authentication is handled by the authentication service, IAuthenticationService, which is used by authentication middleware. The authentication service uses registered authentication handlers to complete authentication-related actions. Examples of authentication-related actions include:

· Authenticating a user.

· Responding when an unauthenticated user tries to access a restricted resource.

The registered authentication handlers and their configuration options are called “schemes”.

Authentication schemes are specified by registering authentication services in Program.cs:

· By calling a scheme-specific extension method after a call to AddAuthentication, such as AddJwtBearer or AddCookie. These extension methods use AuthenticationBuilder.AddScheme to register schemes with appropriate settings.

· Less commonly, by calling AuthenticationBuilder.AddScheme directly.

Enable Cross-Origin Requests (CORS) in ASP.NET Core:

· Browser security prevents a web page from making requests to a different domain than the one that served the web page. This restriction is called the same-origin policy.

· To allow all domains we must mention like below.

· To allow specific domains and restrict others we should configure them like this.

--

--

Subha
Subha

Written by Subha

0 Followers

Everyone has a story to tell,here you would listen mine..!

No responses yet