79323123

Date: 2025-01-02 08:15:43
Score: 1
Natty:
Report link

From my experience, clean and efficient way to do that was that each component use different controllers, however, if there was a method which should work the same, such as yours GetList I would write that specific method in inherited controller like GenericController and call it from all controllers.

That way I would have best of both worlds, from one side one time written logic and just called when needed, but on the another, able to do additional logic in future.

If you want to have one main controller

  1. then point all API calls from blazor to that specific controller, however, be sure to pass URL as parameter to know which component it was called from or (not sure is it visible from stacktrace).
    • Problem with this approach is that if you need different logic for specific endpoint such as [Authorize] attribute it will just get messy and complicated.
Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: 2o3y