C#C
C#3y ago
Ice_

❔ ASP.net MVC repositories

I have three classes, each with their own interface and repository. Let's call the classes Lamp, Sockets and the third class is a basic "joining" class called LampSockets where you just add LampId and SocketId to the table.
It's not the best way to join two classes but that was our way of doing things during this assignment.
My question is, what's the best way to optimize the code? Should I only use the repositories related to the actual class or is it okay to use more than one repository in a class?
Because a part of the assignment is to create something in the joining table without IDs, using a ViewBag with SelectList (which is done).
But listing everything with names instead of Ids (in index) is troublesome when I can't use several repositories. How would I accomplish that?
(I've not been disallowed to use several repositories but I'm just trying to follow the assignment criterias 😅)
Was this page helpful?