Skip to content

Commit 1418457

Browse files
Fix Blazor context manager config issue (#4081)
* Update version to 8.2.5 * #4075 Fix configuration issue * #4075 Add services, don't just try * Use count instead of any * #4075 Don't flow identity back from client to server * Update to target version 8.2.5 * Update release notes
1 parent 9dfe3fc commit 1418457

File tree

11 files changed

+26
-17
lines changed

11 files changed

+26
-17
lines changed

Samples/BlazorExample/BlazorExample/BlazorExample.Client/BlazorExample.Client.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Csla.Blazor.WebAssembly" Version="8.1.1-R24051003" />
12+
<PackageReference Include="Csla.Blazor.WebAssembly" Version="8.2.5" />
1313
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.1" />
1414
</ItemGroup>
1515

Samples/BlazorExample/BlazorExample/BlazorExample.Client/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
builder.Services.AddCsla(o => o
1212
.AddBlazorWebAssembly(o => o.SyncContextWithServer = true)
13-
.Security(o => o.FlowSecurityPrincipalFromClient = true)
13+
.Security(o => o.FlowSecurityPrincipalFromClient = false)
1414
.DataPortal(o => o.ClientSideDataPortal(o => o
1515
.UseHttpProxy(o => o.DataPortalUrl = "/api/DataPortal"))));
1616

Samples/BlazorExample/BlazorExample/BlazorExample/BlazorExample.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
<ProjectReference Include="..\DataAccess.EF\DataAccess.EF.csproj" />
1313
<ProjectReference Include="..\DataAccess.Mock\DataAccess.Mock.csproj" />
1414
<ProjectReference Include="..\DataAccess\DataAccess.csproj" />
15-
<PackageReference Include="Csla.AspNetCore" Version="8.1.1-R24051003" />
16-
<PackageReference Include="Csla.Blazor" Version="8.1.1-R24051003" />
15+
<PackageReference Include="Csla.AspNetCore" Version="8.2.5" />
16+
<PackageReference Include="Csla.Blazor" Version="8.2.5" />
1717
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.1" />
1818
</ItemGroup>
1919

Samples/BlazorExample/BlazorExample/BlazorExample/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
builder.Services.AddCsla(o => o
2121
.AddAspNetCore()
2222
.AddServerSideBlazor(o => o.UseInMemoryApplicationContextManager = false)
23-
.Security(so => so.FlowSecurityPrincipalFromClient = true)
23+
.Security(so => so.FlowSecurityPrincipalFromClient = false)
2424
.DataPortal(dpo => dpo
2525
.AddServerSideDataPortal()
2626
.ClientSideDataPortal(co => co

Samples/BlazorExample/BlazorExample/BusinessLibrary/BusinessLibrary.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Csla" Version="8.1.1-R24051003" />
10+
<PackageReference Include="Csla" Version="8.2.5" />
1111
</ItemGroup>
1212

1313
<ItemGroup>

Samples/BlazorExample/BlazorExample/DataAccess.EF/DataAccess.EF.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Csla" Version="8.1.1-R24051003" />
8+
<PackageReference Include="Csla" Version="8.2.5" />
99
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.1" />
1010
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.1">
1111
<PrivateAssets>all</PrivateAssets>

Samples/BlazorExample/BlazorExample/DataAccess.Mock/DataAccess.Mock.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Csla" Version="8.1.1-R24051003" />
9+
<PackageReference Include="Csla" Version="8.2.5" />
1010
</ItemGroup>
1111

1212
<ItemGroup>

Samples/BlazorExample/BlazorExample/DataAccess/DataAccess.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Csla" Version="8.1.1-R24051003" />
8+
<PackageReference Include="Csla" Version="8.2.5" />
99
</ItemGroup>
1010

1111

Source/Csla.Blazor.WebAssembly/Configuration/ConfigurationExtensions.cs

+5-6
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
using Microsoft.AspNetCore.Authorization;
1111
using Microsoft.AspNetCore.Components.Authorization;
1212
using Microsoft.Extensions.DependencyInjection;
13-
using Microsoft.Extensions.DependencyInjection.Extensions;
1413
using Csla.Blazor.WebAssembly.Configuration;
1514

1615
namespace Csla.Configuration
@@ -40,11 +39,11 @@ public static CslaOptions AddBlazorWebAssembly(this CslaOptions config, Action<B
4039
options?.Invoke(blazorOptions);
4140

4241
config.Services.AddScoped((_) => blazorOptions);
43-
config.Services.TryAddTransient(typeof(ViewModel<>), typeof(ViewModel<>));
44-
config.Services.TryAddScoped<IAuthorizationPolicyProvider, CslaPermissionsPolicyProvider>();
45-
config.Services.TryAddScoped<IAuthorizationHandler, CslaPermissionsHandler>();
46-
config.Services.TryAddScoped(typeof(Csla.Core.IContextManager), typeof(Csla.Blazor.WebAssembly.ApplicationContextManager));
47-
config.Services.TryAddScoped(typeof(AuthenticationStateProvider), typeof(Csla.Blazor.Authentication.CslaAuthenticationStateProvider));
42+
config.Services.AddTransient(typeof(ViewModel<>), typeof(ViewModel<>));
43+
config.Services.AddScoped<IAuthorizationPolicyProvider, CslaPermissionsPolicyProvider>();
44+
config.Services.AddScoped<IAuthorizationHandler, CslaPermissionsHandler>();
45+
config.Services.AddScoped(typeof(Csla.Core.IContextManager), typeof(Csla.Blazor.WebAssembly.ApplicationContextManager));
46+
config.Services.AddScoped(typeof(AuthenticationStateProvider), typeof(Csla.Blazor.Authentication.CslaAuthenticationStateProvider));
4847

4948
// use Blazor state management
5049
config.Services.AddScoped(typeof(ISessionManager), blazorOptions.SessionManagerType);

Source/Csla/Configuration/ConfigurationExtensions.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// </copyright>
77
// <summary>Implement extension methods for base .NET configuration</summary>
88
//-----------------------------------------------------------------------
9+
using Csla.Core;
910
using Csla.DataPortalClient;
1011
using Csla.Runtime;
1112
using Microsoft.Extensions.DependencyInjection;
@@ -70,7 +71,7 @@ private static void RegisterContextManager(IServiceCollection services, Type con
7071
services.AddScoped<Core.ApplicationContextAccessor>();
7172
services.TryAddScoped(typeof(Core.IContextManagerLocal), typeof(Core.ApplicationContextManagerAsyncLocal));
7273

73-
var managerInit = services.Any(i => i.ServiceType.Equals(contextManagerType));
74+
var managerInit = services.Count(static i => i.ServiceType.Equals(typeof(IContextManager))) > 0;
7475
if (managerInit) return;
7576

7677
if (contextManagerType != null)

releasenotes.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,16 @@ CSLA 8 is a substantial update to CSLA .NET, adding support for .NET 8 and other
44

55
## CSLA .NET version 8.2.5 release
66

7-
Updates NuGet package to include latest code changes.
7+
* [#4075](https://github.com/MarimerLLC/csla/issues/4075) Fix configuration issue with Blazor DI services
8+
9+
### Change List
10+
11+
* https://github.com/MarimerLLC/csla/compare/v8.2.4...v8.2.5
12+
13+
### Contributors
14+
15+
* @jmpotvin
16+
* @rockfordlhotka
817

918
## CSLA .NET version 8.2.4 release
1019

0 commit comments

Comments
 (0)