Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

PersistentComponentState Class

Definition

Namespace:
Microsoft.AspNetCore.Components
Assembly:
Microsoft.AspNetCore.Components.dll
Package:
Microsoft.AspNetCore.Components v10.0.0
Package:
Microsoft.AspNetCore.Components v11.0.0-preview.4.26230.115
Package:
Microsoft.AspNetCore.Components v6.0.6
Package:
Microsoft.AspNetCore.Components v7.0.5
Package:
Microsoft.AspNetCore.Components v8.0.19
Package:
Microsoft.AspNetCore.Components v9.0.8
Source:
PersistentComponentState.cs
Source:
PersistentComponentState.cs
Source:
PersistentComponentState.cs
Source:
PersistentComponentState.cs
Source:
PersistentComponentState.cs
Source:
PersistentComponentState.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

The state for the components and services of a components application.

public class PersistentComponentState
type PersistentComponentState = class
Public Class PersistentComponentState
Inheritance
PersistentComponentState

Methods

Name Description
PersistAsJson<TValue>(String, TValue)

Serializes instance as JSON and persists it under the given key.

RegisterOnPersisting(Func<Task>, IComponentRenderMode)

Register a callback to persist the component state when the application is about to be paused. Registered callbacks can use this opportunity to persist their state so that it can be retrieved when the application resumes.

RegisterOnPersisting(Func<Task>)

Register a callback to persist the component state when the application is about to be paused. Registered callbacks can use this opportunity to persist their state so that it can be retrieved when the application resumes.

RegisterOnRestoring(Action, RestoreOptions)

Register a callback to restore the state when the application state is being restored.

TryTakeFromJson<TValue>(String, TValue)

Tries to retrieve the persisted state as JSON with the given key and deserializes it into an instance of type TValue. When the key is present, the state is successfully returned via instance and removed from the PersistentComponentState.

Applies to


Feedback

Was this page helpful?