From b03ccb9658334aa02a524ff9fcfebc7c692d9f68 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Fri, 4 Apr 2025 15:50:11 -0700 Subject: [PATCH 01/14] Add ASP.NET Core release notes for .NET 10 Preview 3 --- .../10.0/preview/preview3/aspnetcore.md | 98 ++++++++++++++++++- 1 file changed, 95 insertions(+), 3 deletions(-) diff --git a/release-notes/10.0/preview/preview3/aspnetcore.md b/release-notes/10.0/preview/preview3/aspnetcore.md index ea6c93966f..61812bd1cb 100644 --- a/release-notes/10.0/preview/preview3/aspnetcore.md +++ b/release-notes/10.0/preview/preview3/aspnetcore.md @@ -2,7 +2,11 @@ Here's a summary of what's new in ASP.NET Core in this preview release: -- [Feature](#feature) +- [Declarative model for persisting state from components and services]( +- #declarative-model-for-persisting-state-from-components-and-services) +- [Reference fingerprinted static web assets in standalone Blazor WebAssembly apps](#reference-fingerprinted-static-web-assets-in-standalone-blazor-webassembly-apps) +- [`HttpClient` response streaming enabled by default on WebAssembly](#httpclient-response-streaming-enabled-by-default-on-webassembly) +- [`DisableMatchAllIgnoresLeftUriPart` app context switch renamed to `EnableMatchAllForQueryStringAndFragment`](#disablematchallignoreslefturipart-app-context-switch-renamed-to-enablementchallofthequerystringandfragment) ASP.NET Core updates in .NET 10: @@ -10,6 +14,94 @@ ASP.NET Core updates in .NET 10: - [Breaking changes](https://docs.microsoft.com/dotnet/core/compatibility/10.0#aspnet-core) - [Roadmap](https://github.com/dotnet/aspnetcore/issues/59443) -## Feature +## Declarative model for persisting state from components and services + +Blazor supports persisting component state during prerendering using the `PersistentComponentState` service, which helps prevent UI flickering when your component does asynchronous initialization. + +You can now declarative specify state to persist from components and configured services using the the `SupplyParameterFromPersistentComponentState` attribute. + +## Reference fingerprinted static web assets in standalone Blazor WebAssembly apps + +Standalone Blazor WebAssembly apps can now reference framework static web assets using either a generated import map or using a fingerprinted URL. The import map and the fingerprinted URLs are generated as part of the build process when you specify the `true` property in the project file. + +**blazorwasm.csproj** + +```diff + + + net10.0 + enable + enable ++ true + + +``` + +To specify where the import map should be generated, add an empty `` element to your *index.html* file. To generate fingerprinted URLs for referenced static web assets, use the `#[.{fingerprint}]` placeholder. + +**index.html** + +```diff + + + + + + + Codestin Search App + + .... ++ + + + +
+ + + + +
+
+ +
+ An unhandled error has occurred. + Reload + 🗙 +
+- ++ + + + +``` + +## `HttpClient` response streaming enabled by default on WebAssembly + +Response streaming is now enabled by default for `HttpClient` in Blazor WebAssembly. This change improves performance and reduces memory usage when handling large responses. However, it also means the response stream no longer supports synchronous operations. If your code requires using synchronous operations, you can opt-out of response streaming for an individual request using the `SetBrowserResponseStreamingEnabled` extension method on the response message: + +```csharp +requestMessage.SetBrowserResponseStreamingEnabled(false); +``` + +## `DisableMatchAllIgnoresLeftUriPart` app context switch renamed to `EnableMatchAllForQueryStringAndFragment` + +The `Microsoft.AspNetCore.Components.Routing.NavLink.DisableMatchAllIgnoresLeftUriPart` app context switch was renamed to `Microsoft.AspNetCore.Components.Routing.NavLink.EnableMatchAllForQueryStringAndFragment`. + +## Community contributors + +Thank you contributors! ❤️ + +- [@NSTom](https://github.com/dotnet/aspnetcore/pulls?q=is%3Apr+is%3Amerged+milestone%3A10.0-preview3+author%3ANSTom) +- [@Varorbc](https://github.com/dotnet/aspnetcore/pulls?q=is%3Apr+is%3Amerged+milestone%3A10.0-preview3+author%3AVarorbc) +- [@Youssef1313](https://github.com/dotnet/aspnetcore/pulls?q=is%3Apr+is%3Amerged+milestone%3A10.0-preview3+author%3AYoussef1313) +- [@alexbeeston](https://github.com/dotnet/aspnetcore/pulls?q=is%3Apr+is%3Amerged+milestone%3A10.0-preview3+author%3Aalexbeeston) +- [@benhopkinstech](https://github.com/dotnet/aspnetcore/pulls?q=is%3Apr+is%3Amerged+milestone%3A10.0-preview3+author%3Abenhopkinstech) +- [@jnjudge1](https://github.com/dotnet/aspnetcore/pulls?q=is%3Apr+is%3Amerged+milestone%3A10.0-preview3+author%3Ajnjudge1) +- [@lextm](https://github.com/dotnet/aspnetcore/pulls?q=is%3Apr+is%3Amerged+milestone%3A10.0-preview3+author%3Alextm) +- [@mapedersen](https://github.com/dotnet/aspnetcore/pulls?q=is%3Apr+is%3Amerged+milestone%3A10.0-preview3+author%3Amapedersen) +- [@nidaca](https://github.com/dotnet/aspnetcore/pulls?q=is%3Apr+is%3Amerged+milestone%3A10.0-preview3+author%3Anidaca) +- [@sander1095](https://github.com/dotnet/aspnetcore/pulls?q=is%3Apr+is%3Amerged+milestone%3A10.0-preview3+author%3Asander1095) +- [@shethaadit](https://github.com/dotnet/aspnetcore/pulls?q=is%3Apr+is%3Amerged+milestone%3A10.0-preview3+author%3Ashethaadit) +- [@smnsht](https://github.com/dotnet/aspnetcore/pulls?q=is%3Apr+is%3Amerged+milestone%3A10.0-preview3+author%3Asmnsht) +- [@xt0rted](https://github.com/dotnet/aspnetcore/pulls?q=is%3Apr+is%3Amerged+milestone%3A10.0-preview3+author%3Axt0rted) -Something about the feature From 76f6b4174ff19ebfbf7fb0e2919689f459f3cac6 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Fri, 4 Apr 2025 18:42:02 -0700 Subject: [PATCH 02/14] Add server-sent events --- .../10.0/preview/preview3/aspnetcore.md | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/release-notes/10.0/preview/preview3/aspnetcore.md b/release-notes/10.0/preview/preview3/aspnetcore.md index 61812bd1cb..987fa295f6 100644 --- a/release-notes/10.0/preview/preview3/aspnetcore.md +++ b/release-notes/10.0/preview/preview3/aspnetcore.md @@ -7,6 +7,7 @@ Here's a summary of what's new in ASP.NET Core in this preview release: - [Reference fingerprinted static web assets in standalone Blazor WebAssembly apps](#reference-fingerprinted-static-web-assets-in-standalone-blazor-webassembly-apps) - [`HttpClient` response streaming enabled by default on WebAssembly](#httpclient-response-streaming-enabled-by-default-on-webassembly) - [`DisableMatchAllIgnoresLeftUriPart` app context switch renamed to `EnableMatchAllForQueryStringAndFragment`](#disablematchallignoreslefturipart-app-context-switch-renamed-to-enablementchallofthequerystringandfragment) +- [Support for Server-Sent Events (SSE)](#support-for-server-sent-events-sse) ASP.NET Core updates in .NET 10: @@ -87,6 +88,34 @@ requestMessage.SetBrowserResponseStreamingEnabled(false); The `Microsoft.AspNetCore.Components.Routing.NavLink.DisableMatchAllIgnoresLeftUriPart` app context switch was renamed to `Microsoft.AspNetCore.Components.Routing.NavLink.EnableMatchAllForQueryStringAndFragment`. +## Support for Server-Sent Events (SSE) + +ASP.NET Core now supports returning a `ServerSentEvents` result using the `TypedResults.ServerSentEvents` API. This feature is supported in both minimal APIs and controller-based apps. + +Server-Sent Events (SSE) is a server push technology that allows a server to send a stream of event messages to a client over a single HTTP connection. In .NET the event messages are represented as [SseItem](https://learn.microsoft.com/dotnet/api/system.net.serversentevents.sseitem-1) objects, which may contain an event type, an ID, and a data payload of type `T`. + +The `TypedResults` class has a new static `ServerSentEvents` method that can be used to return a `ServerSentEvents` result. The first parameter to this method is an `IAsyncEnumerable>` that represents the stream of event messages to be sent to the client. + +The following example illustrates how to use the `TypedResults.ServerSentEvents` API to return a stream of heart rate events as JSON objects to the client: + +```csharp +app.MapGet("/json-item", (CancellationToken cancellationToken) => +{ + async IAsyncEnumerable GetHeartRate( + [EnumeratorCancellation] CancellationToken cancellationToken) + { + while (!cancellationToken.IsCancellationRequested) + { + var heartRate = Random.Shared.Next(60, 100); + yield return HeartRateEvent.Create(heartRate); + await Task.Delay(2000, cancellationToken); + } + } + + return TypedResults.ServerSentEvents(GetHeartRate(cancellationToken), eventType: "heartRate"); +}); +``` + ## Community contributors Thank you contributors! ❤️ From 71c8223197a25e3c8a583549223f073677e40107 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Fri, 4 Apr 2025 19:02:48 -0700 Subject: [PATCH 03/14] Add declarative state persistence --- .../10.0/preview/preview3/aspnetcore.md | 89 ++++++++++++++++++- 1 file changed, 87 insertions(+), 2 deletions(-) diff --git a/release-notes/10.0/preview/preview3/aspnetcore.md b/release-notes/10.0/preview/preview3/aspnetcore.md index 987fa295f6..cc3667236e 100644 --- a/release-notes/10.0/preview/preview3/aspnetcore.md +++ b/release-notes/10.0/preview/preview3/aspnetcore.md @@ -17,9 +17,94 @@ ASP.NET Core updates in .NET 10: ## Declarative model for persisting state from components and services -Blazor supports persisting component state during prerendering using the `PersistentComponentState` service, which helps prevent UI flickering when your component does asynchronous initialization. +You can now declarative specify state to persist from components and services using the the `SupplyParameterFromPersistentComponentState` attribute. Properties with this attribute will automatically be persisted using the `PersistentComponentState` service during prerendering and the loaded when the component renders interactive or the server is instantiated. -You can now declarative specify state to persist from components and configured services using the the `SupplyParameterFromPersistentComponentState` attribute. +Previously, persisting state from a component during prerendering using the `PersistentComponentState` service involved a significant amount of code: + +```razor +@page "/movies" +@inject IMovieService MovieService +@inject PersistentComponentState ApplicationState +@implements IDisposable + +Movies + +

Movies

+ +@if (MoviesList == null) +{ +

Loading...

+} +else +{ + + + + + + +} + +@code { + public List? MoviesList { get; set; } + private PersistingComponentStateSubscription? persistingSubscription; + + protected override async Task OnInitializedAsync() + { + if (!ApplicationState.TryTakeFromJson>("movies", out var movies)) + { + MoviesList = await MovieService.GetMoviesAsync(); + } + else + { + MoviesList = movies; + } + + persistingSubscription = ApplicationState.RegisterOnPersisting(() => + { + ApplicationState.PersistAsJson("movies", MoviesList); + return Task.CompletedTask; + }); + } + + public void Dispose() => persistingSubscription?.Dispose(); +} +``` + +This code can now be simplified using the new declarative model: + +```razor +@page "/movies" +@inject IMovieService MovieService + +Movies + +

Movies

+ +@if (MoviesList == null) +{ +

Loading...

+} +else +{ + + + + + + +} + +@code { + [SupplyParameterFromPersistentComponentState] + public List? MoviesList { get; set; } + + protected override async Task OnInitializedAsync() + { + MoviesList ??= await MovieService.GetMoviesAsync(); + } +} +``` ## Reference fingerprinted static web assets in standalone Blazor WebAssembly apps From 880abb98926a0185f02871d0ab7a28baba85e0ec Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Fri, 4 Apr 2025 19:10:41 -0700 Subject: [PATCH 04/14] Add OpenAPI template option --- release-notes/10.0/preview/preview3/aspnetcore.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/release-notes/10.0/preview/preview3/aspnetcore.md b/release-notes/10.0/preview/preview3/aspnetcore.md index cc3667236e..9843d0eca9 100644 --- a/release-notes/10.0/preview/preview3/aspnetcore.md +++ b/release-notes/10.0/preview/preview3/aspnetcore.md @@ -7,6 +7,7 @@ Here's a summary of what's new in ASP.NET Core in this preview release: - [Reference fingerprinted static web assets in standalone Blazor WebAssembly apps](#reference-fingerprinted-static-web-assets-in-standalone-blazor-webassembly-apps) - [`HttpClient` response streaming enabled by default on WebAssembly](#httpclient-response-streaming-enabled-by-default-on-webassembly) - [`DisableMatchAllIgnoresLeftUriPart` app context switch renamed to `EnableMatchAllForQueryStringAndFragment`](#disablematchallignoreslefturipart-app-context-switch-renamed-to-enablementchallofthequerystringandfragment) +- [OpenAPI support enabled by default in the ASP.NET Core Web API (native AOT) template](#openapi-support-enabled-by-default-in-the-aspnet-core-web-api-native-aot-template) - [Support for Server-Sent Events (SSE)](#support-for-server-sent-events-sse) ASP.NET Core updates in .NET 10: @@ -173,6 +174,12 @@ requestMessage.SetBrowserResponseStreamingEnabled(false); The `Microsoft.AspNetCore.Components.Routing.NavLink.DisableMatchAllIgnoresLeftUriPart` app context switch was renamed to `Microsoft.AspNetCore.Components.Routing.NavLink.EnableMatchAllForQueryStringAndFragment`. +## OpenAPI support enabled by default in the ASP.NET Core Web API (native AOT) template + +The ASP.NET Core Web API (native AOT) project template now has OpenAPI document generation support enabled by default using the Microsoft.AspNetCore.OpenApi package. This support can be disabled if desired using the `--no-openapi` flag when creating a new project from the command-line interface. + +Thank you [@sander1095](https://github.com/sander1095) for this contribution! + ## Support for Server-Sent Events (SSE) ASP.NET Core now supports returning a `ServerSentEvents` result using the `TypedResults.ServerSentEvents` API. This feature is supported in both minimal APIs and controller-based apps. From 4c8e7c03fc185b536816c015d09f9d4680e3ca92 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Fri, 4 Apr 2025 19:15:56 -0700 Subject: [PATCH 05/14] Add min API validation --- .../10.0/preview/preview3/aspnetcore.md | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/release-notes/10.0/preview/preview3/aspnetcore.md b/release-notes/10.0/preview/preview3/aspnetcore.md index 9843d0eca9..12f7612972 100644 --- a/release-notes/10.0/preview/preview3/aspnetcore.md +++ b/release-notes/10.0/preview/preview3/aspnetcore.md @@ -7,6 +7,7 @@ Here's a summary of what's new in ASP.NET Core in this preview release: - [Reference fingerprinted static web assets in standalone Blazor WebAssembly apps](#reference-fingerprinted-static-web-assets-in-standalone-blazor-webassembly-apps) - [`HttpClient` response streaming enabled by default on WebAssembly](#httpclient-response-streaming-enabled-by-default-on-webassembly) - [`DisableMatchAllIgnoresLeftUriPart` app context switch renamed to `EnableMatchAllForQueryStringAndFragment`](#disablematchallignoreslefturipart-app-context-switch-renamed-to-enablementchallofthequerystringandfragment) +- [Validation support in minimal APIs](#validation-support-in-minimal-apis) - [OpenAPI support enabled by default in the ASP.NET Core Web API (native AOT) template](#openapi-support-enabled-by-default-in-the-aspnet-core-web-api-native-aot-template) - [Support for Server-Sent Events (SSE)](#support-for-server-sent-events-sse) @@ -174,6 +175,34 @@ requestMessage.SetBrowserResponseStreamingEnabled(false); The `Microsoft.AspNetCore.Components.Routing.NavLink.DisableMatchAllIgnoresLeftUriPart` app context switch was renamed to `Microsoft.AspNetCore.Components.Routing.NavLink.EnableMatchAllForQueryStringAndFragment`. +## Validation support in minimal APIs + +Support for validation in minimal APIs is now available. This feature allows you to request validation of data sent to your API endpoints. When validation is enabled, the ASP.NET Core runtime will perform any validations defined on query, header, and route parameters, as well as on the request body. Validations can be defined using attributes in the `System.ComponentModel.DataAnnotations` namespace. + +Developers can customize the behavior of the validation system by: + +- creating custom [ValidationAttribute](https://learn.microsoft.com/dotnet/api/system.componentmodel.dataannotations.validationattribute) implementations +- implement the [IValidatableObject](https://learn.microsoft.com/dotnet/api/system.componentmodel.dataannotations.ivalidatableobject) interface for complex validation logic + +When validation fails, the runtime will return a 400 Bad Request response with details of the validation errors. + +To enable built-in validation support for minimal APIs, call the `AddValidation` extension method to register the required services into the service container for your application. + +```csharp +builder.Services.AddValidation(); +``` + +The implementation automatically discovers types that are defined in minimal API handlers or as base types of types defined in minimal API handlers. Validation is then performed on these types by an endpoint filter that is added for each endpoint. + +Validation can be disabled for specific endpoints by using the `DisableValidation` extension method. + +```csharp +app.MapPost("/products", + ([EvenNumber(ErrorMessage = "Product ID must be even")] int productId, [Required] string name) + => TypedResults.Ok(productId)) + .DisableValidation(); +``` + ## OpenAPI support enabled by default in the ASP.NET Core Web API (native AOT) template The ASP.NET Core Web API (native AOT) project template now has OpenAPI document generation support enabled by default using the Microsoft.AspNetCore.OpenApi package. This support can be disabled if desired using the `--no-openapi` flag when creating a new project from the command-line interface. From 2a358ef6e2f81d87648dc48392660369a52c42ac Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Sat, 5 Apr 2025 21:12:57 -0600 Subject: [PATCH 06/14] Add built-time env for Blazor WebAssembly --- .../10.0/preview/preview3/aspnetcore.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/release-notes/10.0/preview/preview3/aspnetcore.md b/release-notes/10.0/preview/preview3/aspnetcore.md index 12f7612972..7eedf6a108 100644 --- a/release-notes/10.0/preview/preview3/aspnetcore.md +++ b/release-notes/10.0/preview/preview3/aspnetcore.md @@ -7,6 +7,7 @@ Here's a summary of what's new in ASP.NET Core in this preview release: - [Reference fingerprinted static web assets in standalone Blazor WebAssembly apps](#reference-fingerprinted-static-web-assets-in-standalone-blazor-webassembly-apps) - [`HttpClient` response streaming enabled by default on WebAssembly](#httpclient-response-streaming-enabled-by-default-on-webassembly) - [`DisableMatchAllIgnoresLeftUriPart` app context switch renamed to `EnableMatchAllForQueryStringAndFragment`](#disablematchallignoreslefturipart-app-context-switch-renamed-to-enablementchallofthequerystringandfragment) +- [Set the environment at build-time for standalone Blazor WebAssembly apps](#set-the-environment-at-build-time-for-standalone-blazor-webassembly-apps) - [Validation support in minimal APIs](#validation-support-in-minimal-apis) - [OpenAPI support enabled by default in the ASP.NET Core Web API (native AOT) template](#openapi-support-enabled-by-default-in-the-aspnet-core-web-api-native-aot-template) - [Support for Server-Sent Events (SSE)](#support-for-server-sent-events-sse) @@ -175,6 +176,21 @@ requestMessage.SetBrowserResponseStreamingEnabled(false); The `Microsoft.AspNetCore.Components.Routing.NavLink.DisableMatchAllIgnoresLeftUriPart` app context switch was renamed to `Microsoft.AspNetCore.Components.Routing.NavLink.EnableMatchAllForQueryStringAndFragment`. +## Set the environment at build-time for standalone Blazor WebAssembly apps + +You can now specify the environment for a standalone Blazor WebAssembly app at build-time using the `` property in the client app's project file (`.csproj`). The `Blazor-Environment` header is no longer produced or honored in .NET 10 for setting the client environment. + +The following example sets the app's environment to `Staging`: + +```xml +Staging +``` + +The default environments applied to the app are: + +* `Development` for build. +* `Production` for publish. + ## Validation support in minimal APIs Support for validation in minimal APIs is now available. This feature allows you to request validation of data sent to your API endpoints. When validation is enabled, the ASP.NET Core runtime will perform any validations defined on query, header, and route parameters, as well as on the request body. Validations can be defined using attributes in the `System.ComponentModel.DataAnnotations` namespace. From 1297de2d40c4fc1fd5cf7c27d190e5aef90911bf Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Sat, 5 Apr 2025 21:23:25 -0600 Subject: [PATCH 07/14] Apply edits --- release-notes/10.0/preview/preview3/aspnetcore.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/release-notes/10.0/preview/preview3/aspnetcore.md b/release-notes/10.0/preview/preview3/aspnetcore.md index 7eedf6a108..4a6539941c 100644 --- a/release-notes/10.0/preview/preview3/aspnetcore.md +++ b/release-notes/10.0/preview/preview3/aspnetcore.md @@ -2,8 +2,7 @@ Here's a summary of what's new in ASP.NET Core in this preview release: -- [Declarative model for persisting state from components and services]( -- #declarative-model-for-persisting-state-from-components-and-services) +- [Declarative model for persisting state from components and services](#declarative-model-for-persisting-state-from-components-and-services) - [Reference fingerprinted static web assets in standalone Blazor WebAssembly apps](#reference-fingerprinted-static-web-assets-in-standalone-blazor-webassembly-apps) - [`HttpClient` response streaming enabled by default on WebAssembly](#httpclient-response-streaming-enabled-by-default-on-webassembly) - [`DisableMatchAllIgnoresLeftUriPart` app context switch renamed to `EnableMatchAllForQueryStringAndFragment`](#disablematchallignoreslefturipart-app-context-switch-renamed-to-enablementchallofthequerystringandfragment) @@ -20,7 +19,7 @@ ASP.NET Core updates in .NET 10: ## Declarative model for persisting state from components and services -You can now declarative specify state to persist from components and services using the the `SupplyParameterFromPersistentComponentState` attribute. Properties with this attribute will automatically be persisted using the `PersistentComponentState` service during prerendering and the loaded when the component renders interactive or the server is instantiated. +You can now declaratively specify state to persist from components and services using the `SupplyParameterFromPersistentComponentState` attribute. Properties with this attribute will automatically be persisted using the `PersistentComponentState` service during prerendering and then loaded when the component renders interactively or the service is instantiated. Previously, persisting state from a component during prerendering using the `PersistentComponentState` service involved a significant amount of code: @@ -111,7 +110,7 @@ else ## Reference fingerprinted static web assets in standalone Blazor WebAssembly apps -Standalone Blazor WebAssembly apps can now reference framework static web assets using either a generated import map or using a fingerprinted URL. The import map and the fingerprinted URLs are generated as part of the build process when you specify the `true` property in the project file. +Standalone Blazor WebAssembly apps can now reference framework static web assets using either a generated import map or using a fingerprinted URL. The import map and fingerprinted URLs are generated during the build process when the `true` property is specified in the project file.. **blazorwasm.csproj** @@ -178,7 +177,7 @@ The `Microsoft.AspNetCore.Components.Routing.NavLink.DisableMatchAllIgnoresLeftU ## Set the environment at build-time for standalone Blazor WebAssembly apps -You can now specify the environment for a standalone Blazor WebAssembly app at build-time using the `` property in the client app's project file (`.csproj`). The `Blazor-Environment` header is no longer produced or honored in .NET 10 for setting the client environment. +You can now specify the environment for a standalone Blazor WebAssembly app at build-time using the `` property in the client app's project file (`.csproj`). In .NET 10, the `Blazor-Environment` header is no longer generated or used for setting the client environment. The following example sets the app's environment to `Staging`: @@ -208,7 +207,7 @@ To enable built-in validation support for minimal APIs, call the `AddValidation` builder.Services.AddValidation(); ``` -The implementation automatically discovers types that are defined in minimal API handlers or as base types of types defined in minimal API handlers. Validation is then performed on these types by an endpoint filter that is added for each endpoint. +The implementation automatically discovers types that are defined in minimal API handlers or as base types of types defined in minimal API handlers. Validation is performed on these types by an endpoint filter added to each endpoint.. Validation can be disabled for specific endpoints by using the `DisableValidation` extension method. @@ -231,7 +230,7 @@ ASP.NET Core now supports returning a `ServerSentEvents` result using the `Typed Server-Sent Events (SSE) is a server push technology that allows a server to send a stream of event messages to a client over a single HTTP connection. In .NET the event messages are represented as [SseItem](https://learn.microsoft.com/dotnet/api/system.net.serversentevents.sseitem-1) objects, which may contain an event type, an ID, and a data payload of type `T`. -The `TypedResults` class has a new static `ServerSentEvents` method that can be used to return a `ServerSentEvents` result. The first parameter to this method is an `IAsyncEnumerable>` that represents the stream of event messages to be sent to the client. +The TypedResults class includes a new static `ServerSentEvents` method for returning a `ServerSentEvents` result. The first parameter to this method is an `IAsyncEnumerable>` that represents the stream of event messages to be sent to the client. The following example illustrates how to use the `TypedResults.ServerSentEvents` API to return a stream of heart rate events as JSON objects to the client: From 86c52e9cc89ef62db0419e350f145aea8f3992db Mon Sep 17 00:00:00 2001 From: Mike Kistler Date: Sun, 6 Apr 2025 13:41:51 -0700 Subject: [PATCH 08/14] Apply suggestions from PR review Co-authored-by: Wade Pickett --- release-notes/10.0/preview/preview3/aspnetcore.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/release-notes/10.0/preview/preview3/aspnetcore.md b/release-notes/10.0/preview/preview3/aspnetcore.md index 4a6539941c..d1c442b2cf 100644 --- a/release-notes/10.0/preview/preview3/aspnetcore.md +++ b/release-notes/10.0/preview/preview3/aspnetcore.md @@ -192,14 +192,14 @@ The default environments applied to the app are: ## Validation support in minimal APIs -Support for validation in minimal APIs is now available. This feature allows you to request validation of data sent to your API endpoints. When validation is enabled, the ASP.NET Core runtime will perform any validations defined on query, header, and route parameters, as well as on the request body. Validations can be defined using attributes in the `System.ComponentModel.DataAnnotations` namespace. +Support for validation in minimal APIs is now available. This feature allows you to request validation of data sent to your API endpoints. When validation is enabled, the ASP.NET Core runtime performs any validations defined on query, header, and route parameters, as well as on the request body. Validations can be defined using attributes in the `System.ComponentModel.DataAnnotations` namespace. Developers can customize the behavior of the validation system by: - creating custom [ValidationAttribute](https://learn.microsoft.com/dotnet/api/system.componentmodel.dataannotations.validationattribute) implementations - implement the [IValidatableObject](https://learn.microsoft.com/dotnet/api/system.componentmodel.dataannotations.ivalidatableobject) interface for complex validation logic -When validation fails, the runtime will return a 400 Bad Request response with details of the validation errors. +When validation fails, the runtime returns a 400 Bad Request response with details of the validation errors. To enable built-in validation support for minimal APIs, call the `AddValidation` extension method to register the required services into the service container for your application. @@ -207,7 +207,7 @@ To enable built-in validation support for minimal APIs, call the `AddValidation` builder.Services.AddValidation(); ``` -The implementation automatically discovers types that are defined in minimal API handlers or as base types of types defined in minimal API handlers. Validation is performed on these types by an endpoint filter added to each endpoint.. +The implementation automatically discovers types that are defined in minimal API handlers or as base types of types defined in minimal API handlers. Validation is performed on these types by an endpoint filter added to each endpoint. Validation can be disabled for specific endpoints by using the `DisableValidation` extension method. From 5d1917e424fc3d44216ab8e9a0fb27b955f562d1 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Mon, 7 Apr 2025 09:21:03 -0600 Subject: [PATCH 09/14] Update release-notes/10.0/preview/preview3/aspnetcore.md Co-authored-by: Wade Pickett --- release-notes/10.0/preview/preview3/aspnetcore.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-notes/10.0/preview/preview3/aspnetcore.md b/release-notes/10.0/preview/preview3/aspnetcore.md index d1c442b2cf..7252a69ecf 100644 --- a/release-notes/10.0/preview/preview3/aspnetcore.md +++ b/release-notes/10.0/preview/preview3/aspnetcore.md @@ -110,7 +110,7 @@ else ## Reference fingerprinted static web assets in standalone Blazor WebAssembly apps -Standalone Blazor WebAssembly apps can now reference framework static web assets using either a generated import map or using a fingerprinted URL. The import map and fingerprinted URLs are generated during the build process when the `true` property is specified in the project file.. +Standalone Blazor WebAssembly apps can now reference framework static web assets using either a generated import map or using a fingerprinted URL. The import map and fingerprinted URLs are generated during the build process when the `true` property is specified in the project file. **blazorwasm.csproj** From f91d1a1c8c03d607148baa9da84a78efa0effc3c Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Mon, 7 Apr 2025 09:21:15 -0600 Subject: [PATCH 10/14] Update release-notes/10.0/preview/preview3/aspnetcore.md Co-authored-by: Wade Pickett --- release-notes/10.0/preview/preview3/aspnetcore.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-notes/10.0/preview/preview3/aspnetcore.md b/release-notes/10.0/preview/preview3/aspnetcore.md index 7252a69ecf..43ac482c3f 100644 --- a/release-notes/10.0/preview/preview3/aspnetcore.md +++ b/release-notes/10.0/preview/preview3/aspnetcore.md @@ -177,7 +177,7 @@ The `Microsoft.AspNetCore.Components.Routing.NavLink.DisableMatchAllIgnoresLeftU ## Set the environment at build-time for standalone Blazor WebAssembly apps -You can now specify the environment for a standalone Blazor WebAssembly app at build-time using the `` property in the client app's project file (`.csproj`). In .NET 10, the `Blazor-Environment` header is no longer generated or used for setting the client environment. +You can now specify the environment for a standalone Blazor WebAssembly app at build-time using the `` property in the client app's project file (`.csproj`). In .NET 10, the `Blazor-Environment` header is no longer generated or used for setting the client environment. The following example sets the app's environment to `Staging`: From 3ce47c4138bf2a4d7a2320b16732244d0c3ea4c6 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Mon, 7 Apr 2025 09:34:46 -0600 Subject: [PATCH 11/14] Update release-notes/10.0/preview/preview3/aspnetcore.md Co-authored-by: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> --- release-notes/10.0/preview/preview3/aspnetcore.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-notes/10.0/preview/preview3/aspnetcore.md b/release-notes/10.0/preview/preview3/aspnetcore.md index 43ac482c3f..489731589e 100644 --- a/release-notes/10.0/preview/preview3/aspnetcore.md +++ b/release-notes/10.0/preview/preview3/aspnetcore.md @@ -197,7 +197,7 @@ Support for validation in minimal APIs is now available. This feature allows you Developers can customize the behavior of the validation system by: - creating custom [ValidationAttribute](https://learn.microsoft.com/dotnet/api/system.componentmodel.dataannotations.validationattribute) implementations -- implement the [IValidatableObject](https://learn.microsoft.com/dotnet/api/system.componentmodel.dataannotations.ivalidatableobject) interface for complex validation logic +- implementing the [IValidatableObject](https://learn.microsoft.com/dotnet/api/system.componentmodel.dataannotations.ivalidatableobject) interface for complex validation logic When validation fails, the runtime returns a 400 Bad Request response with details of the validation errors. From 3ac06d40132523acb0f5a8a59c6ea92a5009f141 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Mon, 7 Apr 2025 09:34:58 -0600 Subject: [PATCH 12/14] Update release-notes/10.0/preview/preview3/aspnetcore.md Co-authored-by: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> --- release-notes/10.0/preview/preview3/aspnetcore.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-notes/10.0/preview/preview3/aspnetcore.md b/release-notes/10.0/preview/preview3/aspnetcore.md index 489731589e..44180ea498 100644 --- a/release-notes/10.0/preview/preview3/aspnetcore.md +++ b/release-notes/10.0/preview/preview3/aspnetcore.md @@ -220,7 +220,7 @@ app.MapPost("/products", ## OpenAPI support enabled by default in the ASP.NET Core Web API (native AOT) template -The ASP.NET Core Web API (native AOT) project template now has OpenAPI document generation support enabled by default using the Microsoft.AspNetCore.OpenApi package. This support can be disabled if desired using the `--no-openapi` flag when creating a new project from the command-line interface. +The ASP.NET Core Web API (native AOT) project template now has OpenAPI document generation support enabled by default using the Microsoft.AspNetCore.OpenApi package. This support can be disabled if desired, using the `--no-openapi` flag when creating a new project from the command-line interface. Thank you [@sander1095](https://github.com/sander1095) for this contribution! From cecedb63d22006aa332ed9aa389cb06b2eb5a7bb Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Mon, 7 Apr 2025 09:36:24 -0600 Subject: [PATCH 13/14] Update release-notes/10.0/preview/preview3/aspnetcore.md --- release-notes/10.0/preview/preview3/aspnetcore.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-notes/10.0/preview/preview3/aspnetcore.md b/release-notes/10.0/preview/preview3/aspnetcore.md index 44180ea498..6ae5ac26c3 100644 --- a/release-notes/10.0/preview/preview3/aspnetcore.md +++ b/release-notes/10.0/preview/preview3/aspnetcore.md @@ -110,7 +110,7 @@ else ## Reference fingerprinted static web assets in standalone Blazor WebAssembly apps -Standalone Blazor WebAssembly apps can now reference framework static web assets using either a generated import map or using a fingerprinted URL. The import map and fingerprinted URLs are generated during the build process when the `true` property is specified in the project file. +Standalone Blazor WebAssembly apps can now reference framework static web assets using either a generated import map or a fingerprinted URL. The import map and fingerprinted URLs are generated during the build process when the `true` property is specified in the project file. **blazorwasm.csproj** From bfa133320d991aa9f99c577308940a23bf11f11b Mon Sep 17 00:00:00 2001 From: Pavel Savara Date: Mon, 7 Apr 2025 18:12:52 +0200 Subject: [PATCH 14/14] Update release-notes/10.0/preview/preview3/aspnetcore.md Co-authored-by: Daniel Roth --- release-notes/10.0/preview/preview3/aspnetcore.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-notes/10.0/preview/preview3/aspnetcore.md b/release-notes/10.0/preview/preview3/aspnetcore.md index 6ae5ac26c3..316c01225e 100644 --- a/release-notes/10.0/preview/preview3/aspnetcore.md +++ b/release-notes/10.0/preview/preview3/aspnetcore.md @@ -165,7 +165,7 @@ To specify where the import map should be generated, add an empty `