WebAssemblyRazorComponentsBuilderExtensions.AddAuthenticationStateSerialization 方法

定义

使用 PersistentComponentState 通过反序列化客户端 AuthenticationStateProvider 序列化服务器端 AuthenticationStateProvider 返回的 AuthenticationState,该 AuthenticationStateProvider 可通过在客户端项目中调用 Microsoft.AspNetCore.Components.WebAssembly.Authentication 包中的 AddAuthenticationStateDeserialization 来添加。

public static Microsoft.Extensions.DependencyInjection.IRazorComponentsBuilder AddAuthenticationStateSerialization (this Microsoft.Extensions.DependencyInjection.IRazorComponentsBuilder builder, Action<Microsoft.AspNetCore.Components.WebAssembly.Server.AuthenticationStateSerializationOptions>? configure = default);
static member AddAuthenticationStateSerialization : Microsoft.Extensions.DependencyInjection.IRazorComponentsBuilder * Action<Microsoft.AspNetCore.Components.WebAssembly.Server.AuthenticationStateSerializationOptions> -> Microsoft.Extensions.DependencyInjection.IRazorComponentsBuilder
<Extension()>
Public Function AddAuthenticationStateSerialization (builder As IRazorComponentsBuilder, Optional configure As Action(Of AuthenticationStateSerializationOptions) = Nothing) As IRazorComponentsBuilder

参数

configure
Action<AuthenticationStateSerializationOptions>

用于自定义 AuthenticationState序列化的回调。

返回

可用于进一步自定义配置的 IRazorComponentsBuilder

适用于