|
| 1 | +# What's New in .NET 10 Preview (LTS): ASP.NET Core, EF Core, and MAUI Features |
| 2 | + |
| 3 | +Release date of .NET 10 is getting closer and Preview 4 version of .NET 10 is released. The .NET team continues to do an impressive job advancing the .NET ecosystem. |
| 4 | + |
| 5 | +.NET 10 will be a long-term support (LTS) release. .NET developers like LTS releases and I think .NET 10 will be used more than .NET 9. |
| 6 | +This is evident when you compare the download counts of .NET NuGet packages on https://www.nuget.org/. |
| 7 | + |
| 8 | +Since our team is mostly focused on web development, we will take a deeper look at ASP.NET Core and EF Core features and improvements in .NET 10. |
| 9 | +ASP.NET Zero also provides a MAUI project which allows you to authenticate via your backend API using Token Based Authentication. Because of that, we will also take a look at MAUI enhancements as well. |
| 10 | + |
| 11 | +For the full list of "What's new in .NET 10", I suggest you to read [https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-10/overview](https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-10/overview). |
| 12 | + |
| 13 | +## What's new in ASP.NET Core for .NET 10 |
| 14 | + |
| 15 | +ASP.NET Core is a strong web application development framework. Let’s explore some of the exciting new features in the upcoming ASP.NET Core 10.0 release. |
| 16 | + |
| 17 | +### Blazor script as static web asset |
| 18 | + |
| 19 | +Currently the Blazor script is served from an embedded resource but with .NET 10, it will be served as a static web asset with automatic compression and fingerprinting. |
| 20 | + |
| 21 | +### Response streaming |
| 22 | + |
| 23 | +In previous versions of Blazor, to use response streaming for HttpClient, you need to enable it. With .NET 10, it is enabled by default. So, if you don't want this, you need to disable it. |
| 24 | + |
| 25 | +In order to disable it, set the `DOTNET_WASM_ENABLE_STREAMING_RESPONSE` environment variable to `false` or `0`. |
| 26 | + |
| 27 | +### Environment in standalone Blazor WebAssembly apps |
| 28 | + |
| 29 | +`Properties/launchSettings.json` will not be used for environment. You need to use `<WasmApplicationEnvironmentName>` attribute in your project file (csproj) with .NET 10. |
| 30 | + |
| 31 | +For example, you can use a syntax like the one below for Development |
| 32 | + |
| 33 | +```xml |
| 34 | +<WasmApplicationEnvironmentName>Development</WasmApplicationEnvironmentName> |
| 35 | +``` |
| 36 | + |
| 37 | +### Preloaded Blazor static assets |
| 38 | + |
| 39 | +For Blazor Web Apps, you can now preloaded static assets. For standalone Blazor WebAssembly apps, you can schedule static assets for high priority downloading. |
| 40 | + |
| 41 | +### OpenAPI 3.1 support |
| 42 | + |
| 43 | +With .NET 10, you can now generate OpenAPI 3.1 documents. The default OpenAPI document version is now 3.1 but you can change it as shown below; |
| 44 | + |
| 45 | +```csharp |
| 46 | +builder.Services.AddOpenApi(options => |
| 47 | +{ |
| 48 | + options.OpenApiVersion = Microsoft.OpenApi.OpenApiSpecVersion.OpenApi3_1; |
| 49 | +}); |
| 50 | +``` |
| 51 | + |
| 52 | +If you are generating OpenAPI documents on build time, you can use `OpenApiGenerateDocumentsOptions` item in your projetc file as shown below; |
| 53 | + |
| 54 | +```xml |
| 55 | +<PropertyGroup> |
| 56 | + <OpenApiGenerateDocumentsOptions>--openapi-version OpenApi3_1</OpenApiGenerateDocumentsOptions> |
| 57 | +</PropertyGroup> |
| 58 | +``` |
| 59 | + |
| 60 | +## What's new in Entity Framework Core for .NET 10 |
| 61 | + |
| 62 | +EF Core is really a great part of .NET ecosystem. I'm using it since its first release and it is getting stronger and robust in each release. |
| 63 | + |
| 64 | +### Vector similarity search |
| 65 | + |
| 66 | +Vector similarity search functionality was added in EF Core 9 as experimental and with EF Core 10, it is no longer experimental. As you may know, Vectors are important in AI world and this is a good sign that Microsoft cares about this in the development process. |
| 67 | + |
| 68 | +### LeftJoin and RightJoin support |
| 69 | + |
| 70 | +Left join is one of the mostly used operation when working with EF Core. In previous versions, if we wanted to make a left join, we need to use `SelectMany`, `GroupJoin` and `DefaultIfEmpty` operations. With EF Core 10, we can start using `LeftJoin` method as shown below; |
| 71 | + |
| 72 | +```csharp |
| 73 | +var query = context.Employees |
| 74 | + .LeftJoin( |
| 75 | + context.Departments, |
| 76 | + employee => employee.DepartmentID, |
| 77 | + department => department.ID, |
| 78 | + (employee, department) => new |
| 79 | + { |
| 80 | + employee.FirstName, |
| 81 | + employee.LastName, |
| 82 | + Department = department.Name ?? "[NONE]" |
| 83 | + }); |
| 84 | +``` |
| 85 | + |
| 86 | +Other than LeftJoin, `RightJoin` is also supported in EF Core 10. |
| 87 | + |
| 88 | +There are also several query improvents. You can see the full list here [https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-10.0/whatsnew#other-query-improvements](https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-10.0/whatsnew#other-query-improvements) |
| 89 | + |
| 90 | +## What's new in .NET MAUI for .NET 10 |
| 91 | + |
| 92 | +### .NET Aspire integration |
| 93 | + |
| 94 | +Maybe the most exciting feature in .NET 10 for MAUI is .NET Aspire integration. There is a new project template which creates a .NET Aspire service defaults project for .NET MAUI. |
| 95 | + |
| 96 | +This integration brings cloud-native capabilities like telemetry, service discovery, and configuration management directly to your mobile apps. |
| 97 | + |
| 98 | +### CollectionView and CarouselView |
| 99 | + |
| 100 | +`CollectionView` and `CarouselView` added in .NET 9 as optional handlers on iOS and Mac Catalyst are now the default handlers. |
| 101 | +`ListView` and `TableView` are also deprecated, so you should use `CollectionView` with .NET 10. If you're still using ListView or TableView, it's a good time to migrate to CollectionView to ensure future compatibility and take advantage of the newer rendering pipeline. |
| 102 | + |
| 103 | +For the full list of important changes in .NET 10 for MAUI, you can check [https://learn.microsoft.com/en-us/dotnet/maui/whats-new/dotnet-10?view=net-maui-9.0](https://learn.microsoft.com/en-us/dotnet/maui/whats-new/dotnet-10?view=net-maui-9.0) |
| 104 | + |
| 105 | +## Conclusion |
| 106 | + |
| 107 | +.NET 10 brings a wide range of improvements across the stack—from better Blazor and API support in ASP.NET Core to stronger data capabilities in EF Core and modernized tooling for .NET MAUI. Since this will be an LTS release, it's a great time to start exploring the new features and preparing your applications for the upgrade. |
0 commit comments