Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3459834
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:09:21+00:00 2026-05-18T10:09:21+00:00

Say I have a class Student and a Student has a Tutor. On my

  • 0

Say I have a class Student and a Student has a Tutor. On my edit student page I want to display a list of Tutors to pick from.

To do this I will at some point need to hit the Student repository to get the current student and the tutor repository to get a list of all tutors. I’m using Dependency Injection to get my repo instances.

I have a view model class which the controller populates before passing to the view for rendering. I have given that class an IEnumerable<Tutor> which I can use in the view to render a dropdown.

My question: who should populate the list of tutors?

Should the controller be responsible for loading all data, or, should I get the view model class to load it? I can’t decide who’s concern this is.

Either way, in a more complicated scenario where there are multiple secondary datasets, one of the classes is going to end up with a contstructor being injected with lots or repositories.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T10:09:22+00:00Added an answer on May 18, 2026 at 10:09 am

    It would definitely be the role of the controller as you don’t want your viewmodel to be bound to always loading that particular list of tutors.

    The interesting problem is, as you said, avoiding having several IRepository instances injected into the constructor and it’s a problem with the repository pattern as a whole and some people have gone as far as to suggest the repository pattern is dead.

    I don’t know if that is the case, but what I would suggest is that you carefully think about how you structure your data access objects so that you avoid situations where you are blindly injecting repositories around, because that can be very detrimental.

    What I tend to do is use the IRepository<> instances as a basis for constructing another repository which has a much closer representation to how my application is accessing data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say i have a object like this public class Student{ public IList<Coursework> Courseworks{get;set;} public
Let's say I have a class of 30 students and want generate every possible
say I have: class Test { public static int Hello = 5; } This
Okay so let's say I have class A... CLASS A has a method that
Say you have a class with an event property. If you instantiate this class
Say I have a class that looks like this (get/set omited): class InfoClass{ String
I have some class like this <div class = student> <div class = name>Adam
Say I'm modeling a school, so I have 2 Entities: Student and Class. For
Say I have: class DecisionTree(private val instances: Array[Instance]){ and I want to calculate another
Let's say I have a Student entity like this implemented using the Play Framework's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.