1 write to State
Microsoft.AspNetCore.Components (1)
Infrastructure\ComponentStatePersistenceManager.cs (1)
25State = new PersistentComponentState(_currentState, _registeredCallbacks);
31 references to State
Microsoft.AspNetCore.Components (3)
Infrastructure\ComponentStatePersistenceManager.cs (3)
42State.InitializeExistingState(data); 62State.PersistingState = true; 84State.PersistingState = false;
Microsoft.AspNetCore.Components.Endpoints (1)
DependencyInjection\RazorComponentsServiceCollectionExtensions.cs (1)
65services.TryAddScoped<PersistentComponentState>(sp => sp.GetRequiredService<ComponentStatePersistenceManager>().State);
Microsoft.AspNetCore.Components.Endpoints.Tests (3)
EndpointHtmlRendererTest.cs (2)
1675services.AddSingleton(sp => sp.GetRequiredService<ComponentStatePersistenceManager>().State); 1680services.AddSingleton<PersistentComponentState>(sp => sp.GetRequiredService<ComponentStatePersistenceManager>().State);
RazorComponentResultTest.cs (1)
467.AddSingleton<PersistentComponentState>(sp => sp.GetRequiredService<ComponentStatePersistenceManager>().State)
Microsoft.AspNetCore.Components.Tests (14)
Lifetime\ComponentStatePersistenceManagerTest.cs (14)
34Assert.True(lifetime.State.TryTakeFromJson<byte[]>("MyState", out var retrieved)); 67lifetime.State.RegisterOnPersisting(() => 69lifetime.State.PersistAsJson("MyState", new byte[] { 1, 2, 3, 4 }); 89lifetime.State.RegisterOnPersisting(() => 91lifetime.State.PersistAsJson("MyState", new byte[] { 1, 2, 3, 4 }); 114lifetime.State.RegisterOnPersisting(() => { invoked = true; return default; }, new TestRenderMode()); 137lifetime.State.RegisterOnPersisting(async () => { sequence.Add(1); await tcs.Task; sequence.Add(3); }, new TestRenderMode()); 138lifetime.State.RegisterOnPersisting(async () => { sequence.Add(2); await tcs2.Task; sequence.Add(4); }, new TestRenderMode()); 165var subscription1 = lifetime.State.RegisterOnPersisting(async () => { sequence.Add(1); await tcs.Task; sequence.Add(3); }); 166var subscription2 = lifetime.State.RegisterOnPersisting(async () => { sequence.Add(2); await tcs2.Task; sequence.Add(4); }); 196lifetime.State.RegisterOnPersisting(() => throw new InvalidOperationException(), new TestRenderMode()); 197lifetime.State.RegisterOnPersisting(() => { invoked = true; return Task.CompletedTask; }, new TestRenderMode()); 222lifetime.State.RegisterOnPersisting(async () => { await tcs.Task; throw new InvalidOperationException(); }, new TestRenderMode()); 223lifetime.State.RegisterOnPersisting(() => { invoked = true; return Task.CompletedTask; }, new TestRenderMode());
Microsoft.AspNetCore.Components.Web.Tests (1)
Forms\EditFormTest.cs (1)
24services.AddSingleton(services => services.GetRequiredService<ComponentStatePersistenceManager>().State);
Microsoft.AspNetCore.Components.WebAssembly (1)
Hosting\WebAssemblyHostBuilder.cs (1)
307Services.AddSingleton<PersistentComponentState>(sp => sp.GetRequiredService<ComponentStatePersistenceManager>().State);
Microsoft.AspNetCore.Mvc.TagHelpers.Test (8)
PersistComponentStateTagHelperTest.cs (8)
91manager.State.RegisterOnPersisting(() => 93manager.State.PersistAsJson("state", "state value"); 121manager.State.RegisterOnPersisting(() => 123manager.State.PersistAsJson("state", "state value"); 150manager.State.RegisterOnPersisting(() => 152manager.State.PersistAsJson("state", "state value"); 203manager.State.RegisterOnPersisting(() => 205manager.State.PersistAsJson("state", "state value");