C
C#5mo ago
quintendc

Modular design

Hello, I'm working on a new project with blazor and want to make it more modular so each module will have a razor class library for the frontend, a class library for the backend and a class library with shared models so: Module.UI (rcl) Module.Backend (cl) Module.Common (cl) using the UI in my blazor is no problem, the UI should also use their own Backend. Now here comes my problem some modules will need some data from on other module. But i don't want any project reference to it. so i thought i could have an extra API project and all modules should have controllers these are then exposed to the API all modules can then interact with each other through the API this way they send data to the API or get Data back in JSON and should handle it by themself which solves my problem. I just have some concerns with this approach: 1: when using API other applications can interact with my backend which is not needed, can i easily reject calls outside my own API? 2. what is the overhead of all these calls between the modules?
1 Reply
Denis
Denis5mo ago
You can use publisher subscriber for this to communicate between decoupled elements of your app. E.g., CommunityToolkit mvvm introduces WeakReferenceMessenger