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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:12:41+00:00 2026-06-01T12:12:41+00:00

We have a method where we go get People. We are using EF and

  • 0

We have a method where we go get People. We are using EF and Ria Services. With the way things are now we call GetPeople and in one situation(example) we get back 920 people. We fill a grid with all this information. We have decided since our app is growing that we should put a cap on this – 500. We have a series of filters we can use as well. Year is one of them. So when I put a filter of 2012 on our search I return 460 people. Our code went from this

return _personSearchRepository.All().Where(x => x.ProgramID == programID && x.PersonType == "Person");

to

return _personSearchRepository.All().Where(x => x.ProgramID == programID && x.PersonType == "Person").Take(500);

we added the Take(500) – problem is when we added this code the first search with no filters returned 500 people – no problems here.
But when we add the year filter – where I would expect 460 to be brought back I got 79.
I took the Take out and I was back to getting 460.

  • 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-06-01T12:12:42+00:00Added an answer on June 1, 2026 at 12:12 pm

    If you add the year filter after the .Take(500), then the filter is applied to those 500 persons. You will have to create a second method or modify the existing one to include a parameter for the filter, which can then be applied before you call .Take(500).

    I assume that your methods return IQueryable<Person>, in which case a filter applied on the client will basically result in something like this:

    _personSearchRepository.All().Where(x => x.ProgramID == programID 
          && x.PersonType == "Person")
       .Take(500).Where(x => x.CreatedYear = 2012);
    

    If you modify the method to look like this:

    IQueryable<Person> GetPersonsWithYearFilter(int year)
    {
        return _personSearchRepository.All().Where(x => x.ProgramID == programID 
              && x.PersonType == "Person" && x.CreatedYear = year)
           .Take(500);
    }
    

    then it should work.

    The above code is not tested.

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

Sidebar

Related Questions

I have this method to get a generic repository out of a dictionary: public
In the following code, i have a method to get a Vector of persons
I have a get method passing in an object of type Store to the
I have this code in a prepareForSegue method // Get destination view UIViewController *viewController
I have a written a method to get all the records and return in
I have a method that is invoked by a scheduler every minute to get
I have a program that makes use of the following method to get a
I have created a Webpage which will post as post method..not as get method.
I have a simple question about usage of Hibernate. I keep seeing people using
I have been using Python for about a year now, coming from a mostly

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.