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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:46:14+00:00 2026-05-26T04:46:14+00:00

I have a very large entity with a few hundred properties. I have a

  • 0

I have a very large entity with a few hundred properties. I have a repository that I use to select this all of the entities and returns an IEnumerable of the entity.

In my controller I then use automapper to map to an index ViewModel of this entity and it only uses two of the properties of the entity in the ViewModel. It takes quite a long time to return compared to a select of the two properties. It would seem that it is selecting all of properties of the entity and then just using two of them.

What would be the recommended way of doing this. Do I need to create the view model in the repository?

Graeme

  • 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-26T04:46:14+00:00Added an answer on May 26, 2026 at 4:46 am

    You can pass a DTO or different model.

    public class LargeEntityDto
    {
        public string Foo { get; set; }
        public string Bar { get; set; }
    }
    

    Then in your repository

    public IEnumerable<LargeEntityDto> GetLargeEntityDtos()
    {
       return context.LargeEntities
          .Select(e => new LargeEntityDto { Foo = e.Foo, Bar = e.Bar});
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very large file that looks like this (see below). I have
I have a very large image that I would like to show a 200x200px
I have a very large code base that contains extensive unit tests (using CppUnit).
I have a very large (~6GB) SVN repository, for which I've written a batch
I have a very large codebase (read: thousands of modules) that has code shared
I have a very large possible data set that I am trying to visualize
I have a UITableView that displays a subset of a large number of entities
We have an ASP classic ERP (very large application) that we want to rewrite
We have some very large data files (5 gig to 1TB) where we need
I have a very large C project with many separate C files and headers

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.