diff --git a/aspnetcore/blazor/components/quickgrid.md b/aspnetcore/blazor/components/quickgrid.md index cc9fde3f8fa2..29e072b89f9f 100644 --- a/aspnetcore/blazor/components/quickgrid.md +++ b/aspnetcore/blazor/components/quickgrid.md @@ -96,6 +96,12 @@ To use Entity Framework (EF) Core as the data source: builder.Services.AddQuickGridEntityFrameworkAdapter(); ``` +QuickGrid supports passing custom attributes to the the rendered table element: + +```razor + +``` + :::moniker-end :::moniker range="< aspnetcore-8.0" diff --git a/aspnetcore/blazor/components/render-modes.md b/aspnetcore/blazor/components/render-modes.md index e020de59a510..0cee739a4a68 100644 --- a/aspnetcore/blazor/components/render-modes.md +++ b/aspnetcore/blazor/components/render-modes.md @@ -458,3 +458,14 @@ You also typically must set the same interactive render mode on the `HeadOutlet` > In an upcoming preview release, a template option for the Blazor Web App template to create the app with root-level interactivity. + +## Discover components from additional assemblies for static server rendering + +Configure additional assemblies to use for discovering routable Razor components for static server rendering using the `AddAdditionalAssemblies` method chained to . + +The following example includes the assembly of the `DifferentAssemblyCounter` component: + +```csharp +app.MapRazorComponents() + .AddAdditionalAssemblies(typeof(DifferentAssemblyCounter).Assembly); +``` diff --git a/aspnetcore/blazor/forms-and-input-components.md b/aspnetcore/blazor/forms-and-input-components.md index 5988da909481..50f8740ad58c 100644 --- a/aspnetcore/blazor/forms-and-input-components.md +++ b/aspnetcore/blazor/forms-and-input-components.md @@ -2744,6 +2744,31 @@ Control the style of validation messages in the app's stylesheet (`wwwroot/css/a } ``` +:::moniker range=">= aspnetcore-8.0" + +## Determine if a form field is valid + + + +Use `EditContext.IsValid(fieldIdentifier)` to determine if a field is valid without obtaining validation messages. + + Supported, but not recommended: + +```csharp +var isValid = !editContext.GetValidationMessages(fieldIdentifier).Any(); +``` + + Recommended: + +```csharp +var isValid = editContext.IsValid(fieldIdentifier); +``` + +> [!NOTE] +> Custom validation examples in this article call on the edit context to determine if a field is valid. An issue has been opened at [Update Blazor form custom validation examples 8.0 (dotnet/AspNetCore.Docs #30338)](https://github.com/dotnet/AspNetCore.Docs/issues/30338) to update the examples to use the new API. We recommend using the new `EditContext.IsValid` API in your own code, but the approach with is still supported and doesn't result in a runtime error if testing the article's examples. + +:::moniker-end + ## Custom validation attributes To ensure that a validation result is correctly associated with a field when using a [custom validation attribute](xref:mvc/models/validation#custom-attributes), pass the validation context's when creating the . diff --git a/aspnetcore/blazor/fundamentals/startup.md b/aspnetcore/blazor/fundamentals/startup.md index fac7e0859e7e..2f61baeec4bc 100644 --- a/aspnetcore/blazor/fundamentals/startup.md +++ b/aspnetcore/blazor/fundamentals/startup.md @@ -462,7 +462,7 @@ In `wwwroot/index.html`, remove the default SVG round indicator in `
= aspnetcore-8.0" + +## Trim .NET IL after ahead-of-time (AOT) compilation + +The `WasmStripILAfterAOT` MSBuild option enables removing the .NET Intermediate Language (IL) for compiled methods after performing AOT compilation to WebAssembly, which reduces the size of the `_framework` folder. + +In the app's project file: + +```xml + + true + true + +``` + +This setting trims away the IL code for most compiled methods, including methods from libraries and methods in the app. Not all compiled methods can be trimmed, as some are still required by the .NET interpreter at runtime. + + + +If you hit any issues using this trimming option, [open an issue on the `dotnet/runtime` GitHub repository](https://github.com/dotnet/runtime/issues). + +:::moniker-end + +:::moniker range=">= aspnetcore-6.0" + ## Runtime relinking One of the largest parts of a Blazor WebAssembly app is the WebAssembly-based .NET runtime (`dotnet.wasm`) that the browser must download when the app is first accessed by a user's browser. Relinking the .NET WebAssembly runtime trims unused runtime code and thus improves download speed. diff --git a/aspnetcore/blazor/project-structure.md b/aspnetcore/blazor/project-structure.md index 1546aec1fff4..149ec1e483ae 100644 --- a/aspnetcore/blazor/project-structure.md +++ b/aspnetcore/blazor/project-structure.md @@ -22,6 +22,12 @@ Blazor Web App project template: `blazor` Project structure: +If both the WebAssembly and Server render modes are selected on app creation, the project template uses the Auto render mode. The Auto render mode initially uses the Server mode while the .NET app bundle and runtime are download to the browser. After the .NET WebAssembly runtime is activated, Auto switches to the WebAssembly render mode. + +By default, the Blazor Web App template enables both static and interactive server rendering using a single project. If you also enable the WebAssembly render mode, the project includes an additional client project (`.Client`) for your WebAssembly-based components. The built output from the client project is downloaded to the browser and executed on the client. Any components using the WebAssembly or Auto render modes must be built from the client project. + +For more information, see . + @@ -57,7 +63,7 @@ Project structure: * App settings files (`appsettings.Development.json`, `appsettings.json`): Provide [configuration settings](xref:blazor/fundamentals/configuration) for the server project. -* Client project: `.Client` +* Client project (`.Client`): * `Pages` folder: Contains the app's routable client-side Razor components (`.razor`). The route for each page is specified using the [`@page`](xref:mvc/views/razor#page) directive. The template includes `Counter` component (`Counter.razor`) that implements the *Counter* page. diff --git a/aspnetcore/blazor/tooling.md b/aspnetcore/blazor/tooling.md index 6b2dd9bb9706..ad4b778f34b7 100644 --- a/aspnetcore/blazor/tooling.md +++ b/aspnetcore/blazor/tooling.md @@ -61,8 +61,16 @@ To create a Blazor app on Windows, use the following guidance: * For a Blazor Web App in the **Additional information** dialog: + * Interactivity with server rendering is enabled by default with the **Use interactive server components** checkbox. - * To enable interactivity with client rendering, select the **Use interactive client components** checkbox. + * To enable interactivity with client rendering, select the **Use interactive WebAssembly components** checkbox. + * To include sample pages and a layout based on Bootstrap styling, select the **Include sample pages** checkbox. Disable this option for an empty project without Bootstrap styling. + + If both the WebAssembly and Server render modes are selected, the template uses the Auto render mode. The Auto render mode initially uses the Server mode while the .NET app bundle and runtime are download to the browser. After the .NET WebAssembly runtime is activated, Auto switches to the WebAssembly render mode. + + By default, the Blazor Web App template enables both static and interactive server rendering using a single project. If you also enable the WebAssembly render mode, the project includes an additional client project (`.Client`) for your WebAssembly-based components. The built output from the client project is downloaded to the browser and executed on the client. Any components using the WebAssembly or Auto render modes must be built from the client project. + + For more information, see .