diff --git a/Samples/ProjectTracker/ProjectTracker.AppServer/ProjectTracker.AppServer.csproj b/Samples/ProjectTracker/ProjectTracker.AppServer/ProjectTracker.AppServer.csproj
index 42faed1935..4df4262866 100644
--- a/Samples/ProjectTracker/ProjectTracker.AppServer/ProjectTracker.AppServer.csproj
+++ b/Samples/ProjectTracker/ProjectTracker.AppServer/ProjectTracker.AppServer.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/Samples/ProjectTracker/ProjectTracker.Blazor/ProjectTracker.Blazor.Client/ProjectTracker.Blazor.Client.csproj b/Samples/ProjectTracker/ProjectTracker.Blazor/ProjectTracker.Blazor.Client/ProjectTracker.Blazor.Client.csproj
index 25c3cb2e48..abfaec3725 100644
--- a/Samples/ProjectTracker/ProjectTracker.Blazor/ProjectTracker.Blazor.Client/ProjectTracker.Blazor.Client.csproj
+++ b/Samples/ProjectTracker/ProjectTracker.Blazor/ProjectTracker.Blazor.Client/ProjectTracker.Blazor.Client.csproj
@@ -10,9 +10,9 @@
-
-
-
+
+
+
diff --git a/Samples/ProjectTracker/ProjectTracker.Blazor/ProjectTracker.Blazor/ProjectTracker.Blazor.csproj b/Samples/ProjectTracker/ProjectTracker.Blazor/ProjectTracker.Blazor/ProjectTracker.Blazor.csproj
index e21537a753..5cd7969984 100644
--- a/Samples/ProjectTracker/ProjectTracker.Blazor/ProjectTracker.Blazor/ProjectTracker.Blazor.csproj
+++ b/Samples/ProjectTracker/ProjectTracker.Blazor/ProjectTracker.Blazor/ProjectTracker.Blazor.csproj
@@ -1,4 +1,4 @@
-
+
net8.0
@@ -12,9 +12,9 @@
-
-
-
+
+
+
diff --git a/Samples/ProjectTracker/ProjectTracker.BusinessLibrary/ProjectTracker.BusinessLibrary.csproj b/Samples/ProjectTracker/ProjectTracker.BusinessLibrary/ProjectTracker.BusinessLibrary.csproj
index c78517f5d1..4d6e2beabb 100644
--- a/Samples/ProjectTracker/ProjectTracker.BusinessLibrary/ProjectTracker.BusinessLibrary.csproj
+++ b/Samples/ProjectTracker/ProjectTracker.BusinessLibrary/ProjectTracker.BusinessLibrary.csproj
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/Samples/ProjectTracker/ProjectTracker.Dal/ProjectTracker.Dal.csproj b/Samples/ProjectTracker/ProjectTracker.Dal/ProjectTracker.Dal.csproj
index 30feed3a8c..8ab6e2463a 100644
--- a/Samples/ProjectTracker/ProjectTracker.Dal/ProjectTracker.Dal.csproj
+++ b/Samples/ProjectTracker/ProjectTracker.Dal/ProjectTracker.Dal.csproj
@@ -7,8 +7,8 @@
-
-
+
+
\ No newline at end of file
diff --git a/Samples/ProjectTracker/ProjectTracker.DalEfCore/ProjectTracker.DalEfCore.csproj b/Samples/ProjectTracker/ProjectTracker.DalEfCore/ProjectTracker.DalEfCore.csproj
index f021091b32..ee1204cc5c 100644
--- a/Samples/ProjectTracker/ProjectTracker.DalEfCore/ProjectTracker.DalEfCore.csproj
+++ b/Samples/ProjectTracker/ProjectTracker.DalEfCore/ProjectTracker.DalEfCore.csproj
@@ -5,9 +5,9 @@
-
-
-
+
+
+
diff --git a/Samples/ProjectTracker/ProjectTracker.DalMock/ProjectTracker.DalMock.csproj b/Samples/ProjectTracker/ProjectTracker.DalMock/ProjectTracker.DalMock.csproj
index a9e529bddf..7a7c6dbb77 100644
--- a/Samples/ProjectTracker/ProjectTracker.DalMock/ProjectTracker.DalMock.csproj
+++ b/Samples/ProjectTracker/ProjectTracker.DalMock/ProjectTracker.DalMock.csproj
@@ -7,8 +7,8 @@
-
-
+
+
diff --git a/Samples/ProjectTracker/global.json b/Samples/ProjectTracker/global.json
new file mode 100644
index 0000000000..a679dd12cf
--- /dev/null
+++ b/Samples/ProjectTracker/global.json
@@ -0,0 +1,5 @@
+{
+ "sdk": {
+ "version": "8.0.401"
+ }
+}
\ No newline at end of file
diff --git a/Source/Csla.Blazor.Test/AppContext/ContextManagerTests.cs b/Source/Csla.Blazor.Test/AppContext/ContextManagerTests.cs
index e273986d73..a56dc99eb9 100644
--- a/Source/Csla.Blazor.Test/AppContext/ContextManagerTests.cs
+++ b/Source/Csla.Blazor.Test/AppContext/ContextManagerTests.cs
@@ -6,8 +6,11 @@
// Context Manager configuration tests
//-----------------------------------------------------------------------
+using System.Security.Claims;
using Csla.Configuration;
using Microsoft.AspNetCore.Components.Authorization;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Http.Features;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -53,7 +56,42 @@ public void UseApplicationContextManagerBlazor()
var applicationContext = serviceProvider.GetRequiredService();
Assert.IsInstanceOfType(applicationContext.ContextManager, typeof(Csla.AspNetCore.Blazor.ApplicationContextManagerBlazor));
+ }
+
+ [TestMethod]
+ public void UseAsyncLocalApplicationContextManager()
+ {
+ var services = new ServiceCollection();
+ services.AddScoped();
+ services.AddHttpContextAccessor();
+ services.AddCsla(o => o
+ .AddAspNetCore()
+ .AddServerSideBlazor(o => o.UseInMemoryApplicationContextManager = false));
+ var serviceProvider = services.BuildServiceProvider();
+
+ var activeState = serviceProvider.GetRequiredService();
+ activeState.CircuitExists = false;
+
+ var applicationContext = serviceProvider.GetRequiredService();
+ Assert.IsInstanceOfType(applicationContext.ContextManager, typeof(Csla.Core.ApplicationContextManagerAsyncLocal));
+ }
+
+ [TestMethod]
+ public void UseAspNetCoreApplicationContextManager()
+ {
+ var services = new ServiceCollection();
+ services.AddScoped();
+ services.AddScoped();
+ services.AddCsla(o => o
+ .AddAspNetCore()
+ .AddServerSideBlazor(o => o.UseInMemoryApplicationContextManager = false));
+ var serviceProvider = services.BuildServiceProvider();
+ var activeState = serviceProvider.GetRequiredService();
+ activeState.CircuitExists = false;
+
+ var applicationContext = serviceProvider.GetRequiredService();
+ Assert.IsInstanceOfType(applicationContext.ContextManager, typeof(Csla.AspNetCore.ApplicationContextManagerHttpContext));
}
}
@@ -65,3 +103,30 @@ public override Task GetAuthenticationStateAsync()
throw new System.NotImplementedException();
}
}
+
+public class HttpContextAccessorFake : IHttpContextAccessor
+{
+ public HttpContext HttpContext { get; set; } = new HttpContextFake();
+}
+
+public class HttpContextFake : HttpContext
+{
+ public override IFeatureCollection Features => throw new NotImplementedException();
+
+ public override HttpRequest Request => throw new NotImplementedException();
+
+ public override HttpResponse Response => throw new NotImplementedException();
+
+ public override ConnectionInfo Connection => throw new NotImplementedException();
+
+ public override WebSocketManager WebSockets => throw new NotImplementedException();
+
+ public override ClaimsPrincipal User { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
+ public override IDictionary