3 instantiations of RestoreContext
Microsoft.AspNetCore.Components (3)
PersistentState\RestoreContext.cs (3)
18public static RestoreContext InitialValue { get; } = new RestoreContext(true, false, false); 24public static RestoreContext LastSnapshot { get; } = new RestoreContext(false, true, false); 30public static RestoreContext ValueUpdate { get; } = new RestoreContext(false, false, true);
90 references to RestoreContext
Microsoft.AspNetCore.Components (14)
PersistentComponentState.cs (4)
34internal RestoreContext CurrentContext { get; private set; } = RestoreContext.InitialValue; 36internal void InitializeExistingState(IDictionary<string, byte[]> existingState, RestoreContext context) 249internal void UpdateExistingState(IDictionary<string, byte[]> state, RestoreContext context)
PersistentState\ComponentStatePersistenceManager.cs (4)
61await RestoreStateAsync(store, RestoreContext.InitialValue); 68/// <param name="context">The <see cref="RestoreContext"/> that provides additional context for the restoration.</param> 70public async Task RestoreStateAsync(IPersistentComponentStateStore store, RestoreContext context) 76if (context != RestoreContext.ValueUpdate)
PersistentState\RestoreContext.cs (6)
16/// Gets a <see cref="RestoreContext"/> that indicates the host is restoring initial values. 18public static RestoreContext InitialValue { get; } = new RestoreContext(true, false, false); 21/// Gets a <see cref="RestoreContext"/> that indicates the host is restoring the last snapshot 24public static RestoreContext LastSnapshot { get; } = new RestoreContext(false, true, false); 27/// Gets the <see cref="RestoreContext"/> that indicates the host is providing an external state 30public static RestoreContext ValueUpdate { get; } = new RestoreContext(false, false, true);
Microsoft.AspNetCore.Components.Endpoints (1)
Rendering\EndpointHtmlRenderer.cs (1)
129await componentApplicationLifetime.RestoreStateAsync(new PrerenderComponentApplicationStore(), RestoreContext.InitialValue);
Microsoft.AspNetCore.Components.Server (7)
Circuits\CircuitFactory.cs (1)
79await appLifetime.RestoreStateAsync(store, RestoreContext.InitialValue);
Circuits\CircuitHost.cs (6)
799var context = (isRestore, _isFirstUpdate) switch 801(_, false) => RestoreContext.ValueUpdate, 802(true, _) => RestoreContext.LastSnapshot, 803(false, _) => RestoreContext.InitialValue 805if (context == RestoreContext.ValueUpdate) 870RestoreContext context,
Microsoft.AspNetCore.Components.Tests (66)
PersistentState\ComponentStatePersistenceManagerTest.cs (10)
123await persistenceManager.RestoreStateAsync(new TestStore([]), RestoreContext.InitialValue); 366await persistenceManager.RestoreStateAsync(store, RestoreContext.InitialValue); 370persistenceManager.RestoreStateAsync(store, RestoreContext.InitialValue)); 387await persistenceManager.RestoreStateAsync(store, RestoreContext.InitialValue); 396await persistenceManager.RestoreStateAsync(store, RestoreContext.ValueUpdate); 403public async Task RestoreStateAsync_RestoresServicesForDifferentContexts(RestoreContext context) 413await persistenceManager.RestoreStateAsync(store, RestoreContext.InitialValue); 444yield return new object[] { RestoreContext.InitialValue }; 445yield return new object[] { RestoreContext.ValueUpdate }; 446yield return new object[] { RestoreContext.LastSnapshot };
PersistentState\PersistentComponentStateTest.cs (10)
25applicationState.InitializeExistingState(existingState, RestoreContext.InitialValue); 42applicationState.InitializeExistingState(existingState, RestoreContext.InitialValue); 73applicationState.InitializeExistingState(existingState, RestoreContext.InitialValue); 163applicationState.InitializeExistingState(existingState, RestoreContext.InitialValue); 181applicationState.InitializeExistingState(existingState, RestoreContext.InitialValue); 198applicationState.InitializeExistingState(new Dictionary<string, byte[]>(), RestoreContext.InitialValue); 217applicationState.InitializeExistingState(new Dictionary<string, byte[]>(), RestoreContext.InitialValue); 236applicationState.InitializeExistingState(new Dictionary<string, byte[]>(), RestoreContext.InitialValue); 255applicationState.InitializeExistingState(new Dictionary<string, byte[]>(), RestoreContext.InitialValue); 274applicationState.InitializeExistingState(new Dictionary<string, byte[]>(), RestoreContext.InitialValue);
PersistentState\PersistentServicesRegistryTest.cs (15)
36await persistenceManager.RestoreStateAsync(new TestStore(new Dictionary<string, byte[]>()), RestoreContext.InitialValue); 79await persistenceManagerOne.RestoreStateAsync(new TestStore(new Dictionary<string, byte[]>()), RestoreContext.InitialValue); 147await persistenceManager.RestoreStateAsync(new TestStore(new Dictionary<string, byte[]>()), RestoreContext.InitialValue); 218await persistenceManagerOne.RestoreStateAsync(new TestStore(new Dictionary<string, byte[]>()), RestoreContext.InitialValue); 227await persistenceManagerTwo.RestoreStateAsync(new TestStore(testStore.State), RestoreContext.InitialValue); 334await persistenceManager.RestoreStateAsync(new TestStore(new Dictionary<string, byte[]>()), RestoreContext.InitialValue); 380await persistenceManager.RestoreStateAsync(new TestStore(new Dictionary<string, byte[]>()), RestoreContext.InitialValue); 422await persistenceManager.RestoreStateAsync(new TestStore(new Dictionary<string, byte[]>()), RestoreContext.InitialValue); 431await initialValueManager.RestoreStateAsync(new TestStore(testStore.State), RestoreContext.InitialValue); 458await persistenceManager.RestoreStateAsync(new TestStore(new Dictionary<string, byte[]>()), RestoreContext.InitialValue); 467await lastSnapshotManager.RestoreStateAsync(new TestStore(testStore.State), RestoreContext.LastSnapshot); 494await persistenceManager.RestoreStateAsync(new TestStore(new Dictionary<string, byte[]>()), RestoreContext.InitialValue); 507await updatedManager.RestoreStateAsync(new TestStore(new Dictionary<string, byte[]>()), RestoreContext.InitialValue); 516await targetManager.RestoreStateAsync(new TestStore(initialStore.State), RestoreContext.InitialValue); 521await targetManager.RestoreStateAsync(new TestStore(updatedStore.State), RestoreContext.ValueUpdate);
PersistentState\RestoreContextTest.cs (8)
15var result = RestoreContext.InitialValue.ShouldRestore(options); 25var result = RestoreContext.InitialValue.ShouldRestore(options); 39var result = RestoreContext.InitialValue.ShouldRestore(options); 51var result = RestoreContext.LastSnapshot.ShouldRestore(options); 61var result = RestoreContext.LastSnapshot.ShouldRestore(options); 75var result = RestoreContext.LastSnapshot.ShouldRestore(options); 88var result = RestoreContext.ValueUpdate.ShouldRestore(options); 101var result = RestoreContext.ValueUpdate.ShouldRestore(options);
PersistentStateValueProviderKeyResolverTests.cs (6)
58persistenceManager.State.InitializeExistingState(state, RestoreContext.InitialValue); 113await persistenceManager.RestoreStateAsync(new TestStore([]), RestoreContext.InitialValue); 166persistenceManager.State.InitializeExistingState(state, RestoreContext.InitialValue); 216persistenceManager.State.InitializeExistingState(state, RestoreContext.InitialValue); 254persistenceManager.State.InitializeExistingState(state, RestoreContext.InitialValue); 293persistenceManager.State.InitializeExistingState(state, RestoreContext.InitialValue);
PersistentStateValueProviderTests.cs (1)
110state.InitializeExistingState(dictionary, RestoreContext.InitialValue);
PersistentValueProviderComponentSubscriptionTests.cs (16)
24state.InitializeExistingState(new Dictionary<string, byte[]>(), RestoreContext.InitialValue); 46state.InitializeExistingState(new Dictionary<string, byte[]>(), RestoreContext.InitialValue); 78state.InitializeExistingState(initialState, RestoreContext.LastSnapshot); 100state.InitializeExistingState(new Dictionary<string, byte[]>(), RestoreContext.InitialValue); 138state.InitializeExistingState(initialState, RestoreContext.LastSnapshot); 168state.InitializeExistingState(initialState, RestoreContext.LastSnapshot); 190state.InitializeExistingState(new Dictionary<string, byte[]>(), RestoreContext.InitialValue); 218state.InitializeExistingState(initialState, RestoreContext.InitialValue); 260await manager.RestoreStateAsync(new TestStore(appState), RestoreContext.InitialValue); 281await renderer.Dispatcher.InvokeAsync(() => manager.RestoreStateAsync(new TestStore(newState), RestoreContext.ValueUpdate)); 309state.InitializeExistingState(initialState, RestoreContext.LastSnapshot); 355state.InitializeExistingState(initialState, RestoreContext.LastSnapshot); 412state.InitializeExistingState(initialState, RestoreContext.LastSnapshot); 650state.InitializeExistingState(new Dictionary<string, byte[]>(), RestoreContext.InitialValue); 673state.InitializeExistingState(new Dictionary<string, byte[]>(), RestoreContext.InitialValue); 696state.InitializeExistingState(new Dictionary<string, byte[]>(), RestoreContext.InitialValue);
Microsoft.AspNetCore.Components.WebAssembly (2)
Hosting\WebAssemblyHost.cs (1)
138await manager.RestoreStateAsync(store, RestoreContext.InitialValue);
Rendering\WebAssemblyRenderer.cs (1)
102await componentStatePersistenceManager.RestoreStateAsync(store, RestoreContext.ValueUpdate);