UML class diagram. Class relationships.

I have a parent class User and child classes Manager and Client. Then I have class Property, Offer and Inquiry. Each Manager must have a list of Inquiries and Offers that he is responsible for, while each Client must have a list of Inquiries and Offers he sent. Each Inquiry or Offer must have Client, Manager and Property objects init. And here is the question, when I log in a Manager to application, I log him in with lists of Inquiries and Offers and then each of the Offer/Inquiry populates with new Manager that has a list of Inquiry/Offer. I feel like this going to be looped and the only solution I came up with is to log in Manager or Client with null lists and then load ALL Inquiries/Offers and loop through them to find matching ID of currently logged in Manager/Client and store them in a Manager/Client lists. Although this approach might be slow in terms of looping, but I see only this way to solve my issue. Will be happy to any kind of comment. Thank you
6 Replies
intermezo
intermezo13mo ago
log in Manager or Client with null lists and then load ALL Inquiries/Offers and loop through them to find matching ID of currently logged in Manager/Client and store them in a Manager/Client lists
i think EF does this under the hood for instance, the Manager.Inquiries getter is a lazy (loaded when needed) list of Inquiries where the ManagerId is equal Manager.Id if you were using conventional SQL, the normal approach would be to query for the manager, then query for the manager inquiries so, it seems okay to me
CurlyRed(Serzhio)
CurlyRed(Serzhio)OP13mo ago
Excuse me, what’s the EF?
intermezo
intermezo13mo ago
entity framework, a tool to transform SQL tables into C# classes
CurlyRed(Serzhio)
CurlyRed(Serzhio)OP13mo ago
Ahh, as part of requirments in uni, im not allowed to use entity frameworks so im just injecting dal into the service class and quering data through service class
intermezo
intermezo13mo ago
sure... i was just giving an example to point your solution seems good
CurlyRed(Serzhio)
CurlyRed(Serzhio)OP13mo ago
i see, thank you intermezo
Want results from more Discord servers?
Add your server