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 4551856
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:41:40+00:00 2026-05-21T16:41:40+00:00

I am wondering sometimes how should I be making my repo methods. I have

  • 0

I am wondering sometimes how should I be making my repo methods.

I have this

 public List<TableA> Get(Guid id)
    {
        return session.Query<TableA>().Where(x => x.Id== id).ToList();
    }

Now I use this in a couple places in my service layers but in one place I need to do a select.

Should I do this

public List<string> GetNames(Guid id)
    {
        return session.Query<TableA>().Where(x => x.Id== id).Select(x => x.Name).ToList();
    }

OR

//this is in my service layer

public void ServiceGet(Guid id)
{
     myRepo.Get(id).Select(x => x.Name).ToList();
}

I am never sure if I should be making a new method or just return some general results and then let the service layer deal with filtering it down.

  • 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-21T16:41:41+00:00Added an answer on May 21, 2026 at 4:41 pm

    You should let your database do as much filtering as possible because that’s what it’s good at. When it comes time to do performance tweaking, this will give you the most flexibility. The tricky part is drawing the fine line between filtering and business logic.

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

Sidebar

Related Questions

I have a general question about this. When you have a gallery, sometimes people
I realize that this topic have been brought up sometimes, but I find myself
I was wondering when I should use List< string > and when I should
Just wondering, when should we actually must use private or protected for some methods
I'm wondering if this is a good design. I have a number of tables
Sometimes $('.classname') and $.find('.classname') gives different result. Wondering what is the difference between both.
Wondering what the best / good way of doing this would be in jQuery.
Wondering if someone could help me. I have next to no knowledge with Ajax,
Wondering if there is any way to get the lambda expressions that result from
I'm writing code for a neural network, and I'm wondering whether I should do

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.