'How to avoid circular dependency with layouts in Blazor Server?
There are three assemblies in a project:
- BlazorServer (Blazor Server)
- Module1.UserInterface (Razor Class Library)
- Module2.UserInterface (Razor Class Library)
Now I added a page layout called PageLayout in Blazor Server, which depends on Mainlayout (within BlazorServer).
To apply the layout in Module1.UserInterface and Module2.UserInterface I need to add @layout PageLayout on the pages in these assemblies.
However, BlazorServer already has a reference to Module1.UserInterface and Module2.UserInterface, so that would end up in a circular dependency.
That leads me to the following question: How can I reference this page layout from within the Module1.UserInterface and Module2.UserInterface?
Is it possible to have yet another assembly (e.g. Shared.UserInterface) with an abstract layout and then use nested layouts as described here)?
Otherwise the easiest solution would be to just have one assembly for the UI, but I would rather research if there is another way first.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
