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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:20:30+00:00 2026-05-12T12:20:30+00:00

My application has to deal with large amounts of data, usual select size is

  • 0

My application has to deal with large amounts of data, usual select size is about 10000 rows. In order to improve performance it is recommended only to select the data needed.

When i have to do calculations or any meaningful business i am comfortable with selecting all the data in order to instantiate my model correctly so i can rely on its functionality.

When only viewing data (most often in a table) this is not what i want, i want to limit the amount of data retrieved to the absolute minimum.

So far i’ve used the following approach to get data from my repositories (shown below is the method that does all the magic inside the repository:

private IEnumerable<TResult> GetAllProject<TResult>(Expression<Func<T, TResult>> selector, Expression<Func<T, bool>> predicate)
{
    SetReadContext();
    var query = DataContex.Table<Order>().Where(predicate).Select(selector);

    return query.ToList();
}

That way i have the type definition for the annonymous type in the method that invokes the repository and i can transparently work with the type there.

Every controller can define exactly what data to pass to the view, it is very efficient as i can directly influence column ordering etc. without having to deal with the Grid Control in the View to do that for me. I don’t need any LoadOptions on the DataContext because it figures that out based on the selector.

The problem is now, that i dont have control the selector that is passed to my Repository.It may aswell contain method invocations etc. that are not translatable.

My question is:

  1. Thus far, i have avoided to create ViewModels because i fear type explosion. What is the best way to implement them? Should i make selectors available that do the projecting for me?
  2. Should i write unit tests that do check nothing but if the query executes without exception?
  • 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-12T12:20:30+00:00Added an answer on May 12, 2026 at 12:20 pm

    I would recommend you create ViewModels so you’re working with a known set of classes, Type Explosion isn’t really a concern, since you’re currently using anonymous types anyway, which are probably a bit harder to manage.

    If you (usually) have a single ViewModel per View then it becomes resonably clean. In some cases you can even share your ViewModels, although I would recommend against it since sooner or later one of the consumers ends up needing more data/fields and the other ends up with a bloated ViewModel.

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

Sidebar

Related Questions

my application has to deal with calendar information (incl. single occurrence, recurrence, etc.). In
My application has a simple data model with 70 read-only records grouped into six
I am currently working on server application that has to deal with reasonable amount
I'm building a web-based productivity application that has to deal with modest user concurrency,
I am developing a cross platform C (C89 standard) application which has to deal
I have an application that has to deal with getting special characters in its
OK, so practically every database based application has to deal with non-active records. Either,
My application has one activity which starts two services but does not bind them.
My application has multiple SQLite tables(around 20 with different fields). This I have created
My Application has 3 activities (MainActivity,SampleActivity,TempActivity) and Application have to start from MainActivity because

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.