Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions aspnetcore/migration/60-70.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ To adopt all of the [new 7.0 features for Blazor apps](xref:aspnetcore-7#blazor)
* Create a new 7.0 Blazor project from one of the Blazor project templates. For more information, see <xref:blazor/tooling>.
* Move the app's components and code to the 7.0 app making modifications to adopt the new 7.0 features.

<!-- HOLD: See https://github.com/dotnet/AspNetCore.Docs/issues/27848

### Simplify component parameter binding

In prior Blazor releases, binding across multiple components required binding to properties with `get`/`set` accessors.
Expand Down Expand Up @@ -111,23 +109,11 @@ In .NET 7, you can use the new `@bind:get` and `@bind:set` modifiers to support
@bind-GrandchildMessage:set="ChildMessageChanged" />
```

> [!IMPORTANT]
> The `@bind:get` and `@bind:set` features are receiving further updates at this time. To take advantage of the latest updates, confirm that you've installed the [latest SDK](https://dotnet.microsoft.com/download/dotnet/7.0).
>
> Using an event callback parameter (`[Parameter] public EventCallback<string> ValueChanged { get; set; }`) isn't supported. Instead, pass an <xref:System.Action>-returning or <xref:System.Threading.Tasks.Task>-returning method to `@bind:set`.
>
> For more information, see the following resources:
>
> * [Blazor `@bind:after` not working on .NET 7 RTM release (dotnet/aspnetcore #44957)](https://github.com/dotnet/aspnetcore/issues/44957)
> * [`BindGetSetAfter701` sample app (javiercn/BindGetSetAfter701 GitHub repository)](https://github.com/javiercn/BindGetSetAfter701)

For more information, see the following content in the *Data binding* article:

* [Introduction](xref:blazor/components/data-binding?view=aspnetcore-7.0)
* [Bind across more than two components](xref:blazor/components/data-binding?view=aspnetcore-7.0#bind-across-more-than-two-components)

-->

### Migrate unmarshalled JavaScript interop

Unmarshalled interop using the <xref:Microsoft.JSInterop.IJSUnmarshalledRuntime> interface is obsolete and should be replaced with JavaScript `[JSImport]`/`[JSExport]` interop.
Expand All @@ -138,7 +124,7 @@ For more information, see <xref:blazor/js-interop/import-export-interop>.

The support for authentication in Blazor WebAssembly apps changed to rely on [navigation history state](xref:blazor/fundamentals/routing?view=aspnetcore-7.0#navigation-history-state) instead of query strings in the URL. As a result, passing the return URL through the query string fails to redirect back to the original page after a successful login in .NET 7.

The following example demonstrates **the prior redirection approach for apps that target .NET 6 or earlier**, which is based on a redirect URL (`?returnUrl=`) with <xref:Microsoft.AspNetCore.Components.NavigationManager.NavigateTo%2A>:
The following example demonstrates **the prior redirection approach for apps that target .NET 6 or earlier** in `RedirectToLogin.razor`, which is based on a redirect URL (`?returnUrl=`) with <xref:Microsoft.AspNetCore.Components.NavigationManager.NavigateTo%2A>:

```razor
@inject NavigationManager Navigation
Expand All @@ -152,7 +138,7 @@ The following example demonstrates **the prior redirection approach for apps tha
}
```

The following example demonstrates **the new redirection approach for apps that target .NET 7 or later**, which is based on [navigation history state](xref:blazor/fundamentals/routing?view=aspnetcore-7.0#navigation-history-state) with <xref:Microsoft.AspNetCore.Components.WebAssembly.Authentication.NavigationManagerExtensions.NavigateToLogin%2A>:
The following example demonstrates **the new redirection approach for apps that target .NET 7 or later** in `RedirectToLogin.razor`, which is based on [navigation history state](xref:blazor/fundamentals/routing?view=aspnetcore-7.0#navigation-history-state) with <xref:Microsoft.AspNetCore.Components.WebAssembly.Authentication.NavigationManagerExtensions.NavigateToLogin%2A>:

```razor
@inject NavigationManager Navigation
Expand Down Expand Up @@ -186,7 +172,7 @@ The following example demonstrates **the prior approach** in `Shared/LoginDispla
}
```

The following example demonstrates **the new approach** that calls <xref:Microsoft.AspNetCore.Components.WebAssembly.Authentication.NavigationManagerExtensions.NavigateToLogout%2A>. The injection (`@inject`) of the <xref:Microsoft.AspNetCore.Components.WebAssembly.Authentication.SignOutSessionStateManager> is removed from the component's directives at the top of the file, and the `BeginLogOut` method is updated to the following code:
The following example demonstrates **the new approach** in `Shared/LoginDisplay.razor` that calls <xref:Microsoft.AspNetCore.Components.WebAssembly.Authentication.NavigationManagerExtensions.NavigateToLogout%2A>. The injection (`@inject`) of the <xref:Microsoft.AspNetCore.Components.WebAssembly.Authentication.SignOutSessionStateManager> is removed from the component's directives at the top of the file, and the `BeginLogOut` method is updated to the following code:

```razor
@code{
Expand Down
Loading