Circular Dependency on ApplicationContext #3112
-
I am upgrading a Blazor WASM app to CSLA 6.1 and I am having an issue with a circular dependency on ApplicationContext. I am using Azure AD for authentication with a ClaimsPrincipalFactory for getting the users application claims from the database once authenticated. I am injecting an I am looking for advice on how to set this up differently to avoid the circular dependency. If need be I can retrieve the claims via a separate web service end point without using CSLA, but I am hoping for a better solution. Error Message:
This is setup up via:
My ClaimsPrinipalFactory looks like this:
Thanks you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
In a Blazor runtime the And the And a lot of things, including the client-side data portal, make use of I suspect the easiest way to break the cycle is to have UPDATE - that probably won't work either will it? That'll still cause a circular reference, just at a different point. So yeah, you might need to use a non-CSLA service. Or maybe defer loading of the current user - do as I suggest here, but make sure the |
Beta Was this translation helpful? Give feedback.
In a Blazor runtime the
IContextManager
implementation does require theApplicationContextManager
service, because that's what has the API to get at the current user.And the
ApplicationContext
service requires/contains anIContextManager
, to get at the per-runtime behavior for accessing the current user (and other per-platform things).And a lot of things, including the client-side data portal, make use of
ApplicationContext
, because that's the app state and also the way to get at the user identity, and much more.I suspect the easiest way to break the cycle is to have
AppClaimsPrincipalFactory
ask for the current service provider, and then you can use that service provider to callGetRe…