calling multiple usecases on a page #807
Unanswered
andrew1555
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi
Is it best practice to call multiple use cases on a single page or would you combine everything you need into a single use case.
For example on a page where we have multiple dropdowns. Would loading in each dropdown as separate use cases make sense. i.e. GetCategoriesQuery, GetUsersQuery. Then call them both separately to bind the dropdowns. This way we can reuse these queries on multiple pages which have the same dropdowns.
Or would we instead have the query for the action i.e. GetActiveJobQuery() return a list of all categories and all assigned users. But then each time this query is used we would end up doing additional data calls for the dropdowns which aren't necessary required each time.
I guess my question is, within a controller or razor page backend, is it ok to call multiple use cases and then keep those use cases single responsibility and perform just the action they are intended to do.
i.e. on load of the page we would call 3 different use cases to load the different UI elements and then 1 final use case to get all the data for the given selected dropdowns. i.e. all jobs for the selected category & user.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions