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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:47:43+00:00 2026-05-15T22:47:43+00:00

I am trying out EF 4.0.I have an Employee Object and using EF I

  • 0

I am trying out EF 4.0.I have an Employee Object and using EF I am getting the Employee ObjectSet by simply calling

Context.Employees

Now the above call will spit following sql query
select * from Employees

The above query works fine and I don’t have any complains on it however as you know this will not be performant enough if you have few millions of records in the table and it will definitely effect the performance.

So then I am trying to figure out a way to give a range to my ObjectSet where I can say something like get me records 30 to 60 from the Employee ObjectSet.

Is there a way to do something like this.

Any suggestions will be deeply appreciated.

Update:
I am trying to do this to get 20 Employees (page size) back based on the page index.

Thanks in advance.
NiK…

  • 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-15T22:47:44+00:00Added an answer on May 15, 2026 at 10:47 pm

    Ok, I finally figured out a way to do this which I think is pretty decent. And here is what I did.

    I used the Skip and Take methods in IQueryable to skip and take objects based on the page index.

    So I used the following code:

    var empList = context.Employees.OrderBy("it.CreatedDate").Skip(pageIndex * 20 - 20).Take(20);
    

    This is one way.

    If anyone feel that this is not a good solution you are more than welcome to come up with something else which I can replace with.

    Updated Code
    As per Yury Tarabanko’s suggestion I changed my code as follows:

    var empList = context.Employees.OrderBy(x=>x.CreatedDate).Skip(pageIndex * 20 - 20).Take(20);
    

    Thanks for those who took time to read my question.

    Thnq,
    NiK…

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

Sidebar

Related Questions

I'm trying out KO but have problems getting observableArray to work, the code is
I'm trying out http://emacspeak.sourceforge.net now that I have it running on windows. I'd like
I have been trying out the NameValueDeserializer from MVCContrib, which will take a IList
I have been trying out the MoreLikeThis Bundle to bring back a set of
I have been trying out Cassandra and need some help in understanding a few
I'm trying out ASP.NET MVC routing and have of course stumbled across a problem.
I am trying out a little reflection and have a question on how the
Hi I am trying out drawing app and have a problem when it comes
I was planning on trying out Re-Fox: http://www.refox.net/ They have a demo version -
I am trying out GWT in this 'configuration': 1) I have written a server

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.