© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
4 replies
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 😅)
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

ASP.NET MVC
C#CC# / help
3y ago
ASP.NET MVC
C#CC# / help
3y ago
React + ASP.NET MVC
C#CC# / help
2y ago