Skip to content

Fix Blazor context manager service config issue #4089

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rockfordlhotka opened this issue Jul 9, 2024 · 3 comments
Closed

Fix Blazor context manager service config issue #4089

rockfordlhotka opened this issue Jul 9, 2024 · 3 comments
Assignees

Comments

@rockfordlhotka
Copy link
Member

I am working with Scoped Services that retrieve information using CSLA Business Objects. After upgrading to version 8.2.5, I encountered the following error:

Do not call GetAuthenticationStateAsync outside of the DI scope for a Razor component

I noticed that this issue might have been addressed in #3614 , but it still persists for me with the following configuration:

builder.Services.AddCsla(o => o
             .AddAspNetCore()
             .AddServerSideBlazor(ssb => ssb.UseInMemoryApplicationContextManager = true)
             .Security(so => so.FlowSecurityPrincipalFromClient = true)
             .DataPortal(dpo => dpo
               .AddServerSideDataPortal()
               .ClientSideDataPortal(co => co
                   .UseLocalProxy())));

Can someone provide guidance on the proper configuration needed to call a CSLA Business Object from a Service within a Razor component?

Originally posted by @jmpotvin in #4088

@rockfordlhotka
Copy link
Member Author

@jmpotvin

I started creating some unit tests with a config like this, and it works:

builder.Services.AddCsla(o => o
             .AddAspNetCore()
             .AddServerSideBlazor(ssb => ssb.UseInMemoryApplicationContextManager = true)
             .Security(so => so.FlowSecurityPrincipalFromClient = true));

This is all you should normally need to set up a Blazor server app.

I'll test with the extra data portal config later, but that shouldn't be necessary at all.

@jmpotvin
Copy link

Thanks @rockfordlhotka.

I converted everything to 8.2.5, and it's working fine now. I'm not sure what I was doing wrong before.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

No branches or pull requests

2 participants