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