Skip to content

Commit 2cd131c

Browse files
authored
Merge pull request #35279 from dotnet/main
2 parents aa90b31 + a880b5c commit 2cd131c

28 files changed

Lines changed: 273 additions & 180 deletions

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ DocFX requires:
188188

189189
## Voice and tone
190190

191-
Our goal is to write documentation that is easily understandable by the widest possible audience. To that end, we established guidelines for writing style that we ask our contributors to follow. For more information, see [Voice and tone guidelines](https://github.com/dotnet/docs/blob/main/styleguide/voice-tone.md) in the .NET repo.
191+
Our goal is to write documentation that is easily understandable by the widest possible audience. To that end, we established guidelines for writing style that we ask our contributors to follow. For more information, see [Voice and tone guidelines](/contribute/content/dotnet/dotnet-voice-tone).
192192

193193
## Microsoft Writing Style Guide
194194

aspnetcore/blazor/components/prerender.md

Lines changed: 3 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,10 @@ To preserve prerendered state, use the `[SupplyParameterFromPersistentComponentS
5353

5454
By default, properties are serialized using the <xref:System.Text.Json?displayProperty=fullName> serializer with default settings. Serialization isn't trimmer safe and requires preservation of the types used. For more information, see <xref:blazor/host-and-deploy/configure-trimmer>.
5555

56-
The following example demonstrates the general pattern, where the `{TYPE}` placeholder represents the type of data to persist.
56+
The following counter component persists counter state during prerendering and retrieves the state to initialize the component:
5757

58-
```razor
59-
@code {
60-
[SupplyParameterFromPersistentComponentState]
61-
public {TYPE} Data { get; set; }
62-
63-
protected override async Task OnInitializedAsync()
64-
{
65-
Data ??= await ...;
66-
}
67-
}
68-
```
69-
70-
The following counter component example persists counter state during prerendering and retrieves the state to initialize the component.
58+
* The `[SupplyParameterFromPersistentComponentState]` attribute is applied to the `CounterState` type (`State`).
59+
* The counter's state is assigned when `null` in `OnInitialized` and restored automatically when the component renders interactively.
7160

7261
`PrerenderedCounter2.razor`:
7362

@@ -252,51 +241,6 @@ Serialized properties are identified from the actual service instance:
252241

253242
As an alternative to using the declarative model for persisting state with the `[SupplyParameterFromPersistentComponentState]` attribute, you can use the <xref:Microsoft.AspNetCore.Components.PersistentComponentState> service directly, which offers greater flexibility for complex state persistence scenarios. Call <xref:Microsoft.AspNetCore.Components.PersistentComponentState.RegisterOnPersisting%2A?displayProperty=nameWithType> to register a callback to persist the component state during prerendering. The state is retrieved when the component renders interactively. Make the call at the end of initialization code in order to avoid a potential race condition during app shutdown.
254243

255-
The following example demonstrates the general pattern:
256-
257-
* The `{TYPE}` placeholder represents the type of data to persist.
258-
* The `{TOKEN}` placeholder is a state identifier string. Consider using `nameof({VARIABLE})`, where the `{VARIABLE}` placeholder is the name of the variable that holds the state. Using [`nameof()`](/dotnet/csharp/language-reference/operators/nameof) for the state identifier avoids the use of a quoted string.
259-
260-
```razor
261-
@implements IDisposable
262-
@inject PersistentComponentState ApplicationState
263-
264-
...
265-
266-
@code {
267-
private {TYPE} data;
268-
private PersistingComponentStateSubscription persistingSubscription;
269-
270-
protected override async Task OnInitializedAsync()
271-
{
272-
if (!ApplicationState.TryTakeFromJson<{TYPE}>(
273-
"{TOKEN}", out var restored))
274-
{
275-
data = await ...;
276-
}
277-
else
278-
{
279-
data = restored!;
280-
}
281-
282-
// Call at the end to avoid a potential race condition at app shutdown
283-
persistingSubscription = ApplicationState.RegisterOnPersisting(PersistData);
284-
}
285-
286-
private Task PersistData()
287-
{
288-
ApplicationState.PersistAsJson("{TOKEN}", data);
289-
290-
return Task.CompletedTask;
291-
}
292-
293-
void IDisposable.Dispose()
294-
{
295-
persistingSubscription.Dispose();
296-
}
297-
}
298-
```
299-
300244
The following counter component example persists counter state during prerendering and retrieves the state to initialize the component.
301245

302246
`PrerenderedCounter3.razor`:
@@ -366,51 +310,6 @@ When the component executes, `currentCount` is only set once during prerendering
366310

367311
To preserve prerendered state, decide what state to persist using the <xref:Microsoft.AspNetCore.Components.PersistentComponentState> service. <xref:Microsoft.AspNetCore.Components.PersistentComponentState.RegisterOnPersisting%2A?displayProperty=nameWithType> registers a callback to persist the component state during prerendering. The state is retrieved when the component renders interactively. Make the call at the end of initialization code in order to avoid a potential race condition during app shutdown.
368312

369-
The following example demonstrates the general pattern:
370-
371-
* The `{TYPE}` placeholder represents the type of data to persist.
372-
* The `{TOKEN}` placeholder is a state identifier string. Consider using `nameof({VARIABLE})`, where the `{VARIABLE}` placeholder is the name of the variable that holds the state. Using [`nameof()`](/dotnet/csharp/language-reference/operators/nameof) for the state identifier avoids the use of a quoted string.
373-
374-
```razor
375-
@implements IDisposable
376-
@inject PersistentComponentState ApplicationState
377-
378-
...
379-
380-
@code {
381-
private {TYPE} data;
382-
private PersistingComponentStateSubscription persistingSubscription;
383-
384-
protected override async Task OnInitializedAsync()
385-
{
386-
if (!ApplicationState.TryTakeFromJson<{TYPE}>(
387-
"{TOKEN}", out var restored))
388-
{
389-
data = await ...;
390-
}
391-
else
392-
{
393-
data = restored!;
394-
}
395-
396-
// Call at the end to avoid a potential race condition at app shutdown
397-
persistingSubscription = ApplicationState.RegisterOnPersisting(PersistData);
398-
}
399-
400-
private Task PersistData()
401-
{
402-
ApplicationState.PersistAsJson("{TOKEN}", data);
403-
404-
return Task.CompletedTask;
405-
}
406-
407-
void IDisposable.Dispose()
408-
{
409-
persistingSubscription.Dispose();
410-
}
411-
}
412-
```
413-
414313
The following counter component example persists counter state during prerendering and retrieves the state to initialize the component.
415314

416315
`PrerenderedCounter2.razor`:

aspnetcore/blazor/host-and-deploy/webassembly/bundle-caching-and-integrity-check-failures.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ When a Blazor WebAssembly app loads in the browser, the app downloads boot resou
2020
* .NET runtime and assemblies
2121
* Locale specific data
2222

23-
Except for Blazor's boot manifest file (`dotnet.boot.js` in .NET 10 or later, `blazor.boot.json` prior to .NET 10), WebAssembly .NET runtime and app bundle files are cached on clients. The Blazor boot configuration contains a manifest of the files that make up the app that must be downloaded along with a hash of the file's content that's used to detect whether any of the boot resources have changed. Blazor caches downloaded files using the browser [Cache](https://developer.mozilla.org/docs/Web/API/Cache) API.
23+
Except for Blazor's boot manifest file (`blazor.boot.json` ) prior to the release of .NET 10, WebAssembly .NET runtime and app bundle files are cached on clients. The Blazor boot configuration, inlined into `dotnet.js` in .NET 10 or later, contains a manifest of the files that make up the app that must be downloaded along with a hash of the file's content that's used to detect whether any of the boot resources have changed. Blazor caches downloaded files using the browser [Cache](https://developer.mozilla.org/docs/Web/API/Cache) API.
2424

2525
When Blazor WebAssembly downloads an app's startup files, it instructs the browser to perform integrity checks on the responses. Blazor sends SHA-256 hash values for DLL (`.dll`), WebAssembly (`.wasm`), and other files in the Blazor boot configuration, which isn't cached on clients. The file hashes of cached files are compared to the hashes in the Blazor boot configuration. For cached files with a matching hash, Blazor uses the cached files. Otherwise, files are requested from the server. After a file is downloaded, its hash is checked again for integrity validation. An error is generated by the browser if any downloaded file's integrity check fails.
2626

aspnetcore/blazor/host-and-deploy/webassembly/deployment-layout.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ The approach demonstrated in this article serves as a starting point for develop
4646

4747
The approach described in this article is used by the *experimental* [`Microsoft.AspNetCore.Components.WebAssembly.MultipartBundle` package (NuGet.org)](https://www.nuget.org/packages/Microsoft.AspNetCore.Components.WebAssembly.MultipartBundle) for apps targeting .NET 6 or later. The package contains MSBuild targets to customize the Blazor publish output and a [JavaScript initializer](xref:blazor/js-interop/index#javascript-initializers) to use a custom [boot resource loader](xref:blazor/fundamentals/startup#load-boot-resources), each of which are described in detail later in this article.
4848

49-
[Experimental code (includes the NuGet package reference source and `CustomPackagedApp` sample app)](https://github.com/aspnet/AspLabs/tree/main/src/BlazorWebAssemblyCustomInitialization)
50-
5149
> [!WARNING]
5250
> Experimental and preview features are provided for the purpose of collecting feedback and aren't supported for production use.
5351

aspnetcore/blazor/security/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,8 @@ To handle the case where the user must satisfy several policies simultaneously,
12301230

12311231
Claims-based authorization is a special case of policy-based authorization. For example, you can define a policy that requires users to have a certain claim. For more information, see <xref:security/authorization/policies>.
12321232

1233+
If both <xref:Microsoft.AspNetCore.Components.Authorization.AuthorizeView.Roles> and <xref:Microsoft.AspNetCore.Components.Authorization.AuthorizeView.Policy> are set, authorization succeeds only when both conditions are satisfied. That is, the user must belong to at least one of the specified roles *and* meet the requirements defined by the policy.
1234+
12331235
If neither <xref:Microsoft.AspNetCore.Components.Authorization.AuthorizeView.Roles> nor <xref:Microsoft.AspNetCore.Components.Authorization.AuthorizeView.Policy> is specified, <xref:Microsoft.AspNetCore.Components.Authorization.AuthorizeView> uses the default policy:
12341236

12351237
* Authenticated (signed-in) users are authorized.

aspnetcore/data/ef-rp/intro.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ This is the first in a series of tutorials that show how to use Entity Framework
2727

2828
# [Visual Studio](#tab/visual-studio)
2929

30-
[!INCLUDE[VS prereqs](~/includes/net-prereqs-vs-6.0.md)]
30+
[!INCLUDE[VS prereqs](~/includes/net-prereqs-vs-latest.md)]
3131

3232
### Database engines
3333

@@ -559,15 +559,15 @@ This is the first in a series of tutorials that show how to use Entity Framework
559559

560560
# [Visual Studio](#tab/visual-studio)
561561

562-
[!INCLUDE[VS prereqs](~/includes/net-core-prereqs-vs-5.0.md)]
562+
[!INCLUDE[VS prereqs](~/includes/net-prereqs-vs-latest.md)]
563563

564564
### Database engines
565565

566566
The Visual Studio instructions use [SQL Server LocalDB](/sql/database-engine/configure-windows/sql-server-2016-express-localdb), a version of SQL Server Express that runs only on Windows.
567567

568568
# [Visual Studio Code](#tab/visual-studio-code)
569569

570-
[!INCLUDE[VS Code prereqs](~/includes/net-core-prereqs-vsc-5.0.md)]
570+
[!INCLUDE[VS Code prereqs](~/includes/net-prereqs-vsc-latest.md)]
571571

572572
Consider downloading and installing a third-party tool for managing and viewing a SQLite database, such as [DB Browser for SQLite](https://sqlitebrowser.org/).
573573

@@ -1073,11 +1073,11 @@ This is the first in a series of tutorials that show how to use Entity Framework
10731073

10741074
# [Visual Studio](#tab/visual-studio)
10751075

1076-
[!INCLUDE[VS prereqs](~/includes/net-core-prereqs-vs-3.0.md)]
1076+
[!INCLUDE[VS prereqs](~/includes/net-prereqs-vs-latest.md)]
10771077

10781078
# [Visual Studio Code](#tab/visual-studio-code)
10791079

1080-
[!INCLUDE[VS Code prereqs](~/includes/net-core-prereqs-vsc-3.0.md)]
1080+
[!INCLUDE[VS Code prereqs](~/includes/net-prereqs-vsc-latest.md)]
10811081

10821082
---
10831083

aspnetcore/data/scaffold_RP.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ content_well_notification: AI-contribution
1010
ai-usage: ai-assisted
1111
uid: data/dotnet-scaffold-rp
1212
---
13-
1413
# Scaffold a data model with dotnet scaffold in a Razor Pages project
1514

1615
The CLI tool, [dotnet scaffold](https://www.nuget.org/packages/Microsoft.dotnet-scaffold) creates data access UI for many .NET project types, such as API, Aspire, Blazor, MVC, and Razor Pages. `dotnet scaffold` can be run interactively or as a command line tool via passing parameter values.
@@ -39,7 +38,7 @@ To navigate the UI, use the:
3938

4039
## Create and scaffold a data model in a Razor Pages project
4140

42-
If you have any problems with the following steps, see [Tutorial: Create a Razor Pages web app with ASP.NET Core](/aspnet/core/tutorials/razor-pages/) and select the **Visual Studio Code** tab.
41+
If you have any problems with the following steps, see <xref:tutorials/razor-pages/index?tabs=visual-studio-code>.
4342

4443
1. Run the following commands to create a Razor Pages project and navigate to the projects folder:
4544
```dotnetcli
@@ -78,7 +77,7 @@ In The preceding commands:
7877

7978
* `dotnet tool uninstall --global dotnet-ef` uninstalls the `dotnet-ef` tool. Uninstalling ensures the latest tool is successfully installed. If `dotnet-ef` isn't installed, an error messages **A tool with the package Id 'dotnet-ef' could not be found.** You can ignore this message.
8079
* `dotnet tool install --global dotnet-ef` installs globally the `dotnet-ef` tool.
81-
* `dotnet ef migrations add initialMigration` adds the initial migration. For more information, see [Create the initial database schema using EF's migration feature](/aspnet/core/tutorials/razor-pages/model&tabs=visual-studio-code)
80+
* `dotnet ef migrations add initialMigration` adds the initial migration. For more information, see <xref:tutorials/razor-pages/model?tabs=visual-studio-code>.
8281
* `dotnet ef database update` applies the migrations to the database.
8382

8483
Run the app:
@@ -94,5 +93,5 @@ Run the app:
9493

9594
* [dotnet scaffold repo on GitHub](https://github.com/dotnet/Scaffolding)
9695
* [How to manage .NET tools](/dotnet/core/tools/global-tools)
97-
* [Microsoft.dotnet-scaffold](https://www.nuget.org/packages/Microsoft.dotnet-scaffold) NuGet package.
98-
* [Detailed tutorial on EF scaffolding Razor Pages](/aspnet/core/data/scaffold_rp)
96+
* [`Microsoft.dotnet-scaffold`](https://www.nuget.org/packages/Microsoft.dotnet-scaffold) NuGet package.
97+
* <xref:data/dotnet-scaffold-rp>

aspnetcore/fundamentals/app-state.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ To enable the session-based TempData provider, use the <xref:Microsoft.Extension
230230

231231
A limited amount of data can be passed from one request to another by adding it to the new request's query string. This is useful for capturing state in a persistent manner that allows links with embedded state to be shared through email or social networks. Because URL query strings are public, never use query strings for sensitive data.
232232

233-
In addition to unintended sharing, including data in query strings can expose the app to [Cross-Site Request Forgery (CSRF)](https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)) attacks. Any preserved session state must protect against CSRF attacks. For more information, see <xref:security/anti-request-forgery>.
233+
In addition to unintended sharing, including data in query strings can expose the app to [Cross-Site Request Forgery (CSRF)](https://owasp.org/www-community/attacks/csrf) attacks. Any preserved session state must protect against CSRF attacks. For more information, see <xref:security/anti-request-forgery>.
234234

235235
## Hidden fields
236236

@@ -507,7 +507,7 @@ To enable the session-based TempData provider, use the <xref:Microsoft.Extension
507507

508508
A limited amount of data can be passed from one request to another by adding it to the new request's query string. This is useful for capturing state in a persistent manner that allows links with embedded state to be shared through email or social networks. Because URL query strings are public, never use query strings for sensitive data.
509509

510-
In addition to unintended sharing, including data in query strings can expose the app to [Cross-Site Request Forgery (CSRF)](https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)) attacks. Any preserved session state must protect against CSRF attacks. For more information, see <xref:security/anti-request-forgery>.
510+
In addition to unintended sharing, including data in query strings can expose the app to [Cross-Site Request Forgery (CSRF)](https://owasp.org/www-community/attacks/csrf) attacks. Any preserved session state must protect against CSRF attacks. For more information, see <xref:security/anti-request-forgery>.
511511

512512
## Hidden fields
513513

0 commit comments

Comments
 (0)