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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:31:24+00:00 2026-05-24T13:31:24+00:00

Relations is probably the wrong word to use, but Data tables are what I

  • 0

Relations is probably the wrong word to use, but Data tables are what I have used before. I have EF4 pulling from a SQL database. Tables like Customer, Company, Department; things that usually go into Comboboxes for selection. I am holding them in static lists (only needs to populate on app startup), and I have a few comboboxes itemssource bound to them, which makes setting “relating” a specific selection easy by binding the selected item from the ViewModel.

My problem is, in a few places I just need a the name associated with an ID in a datagrid for display only. A couple hundred rows with a CompanyId that needs to be a CompanyName. I am concerned about performance here. I could use the DB FK’s to get the names during the lookup, but thats seems like a waste since I have them all in static lists. I also don’t know if Lazy loading would mean they get looked up during data binding, or during the initial query.

What is the best solution here? Can you make a wpf value converter using static lists? Should I perform a foreach on the data after getting it, and looking the values in the static list, storing the Name in the object?

  • 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-24T13:31:24+00:00Added an answer on May 24, 2026 at 1:31 pm

    You could build this logic into your query:

    var viewModels = (from c in objectContext.Customers
                     select new MyGridViewModel {
                           CustomerId = c.CustomerId,
                           CompanyId = c.CompanyId,
                           CompanyName = c.Company.Name
                     }).ToList();
    

    This will eliminate the need to fetch all of your columns (only CustomerId, CompanyId, and Company Name will be returned. You also won’t be lazy loading the Customer’s Company.

    Then you can simple bind your View Models to the grid:

    myGrid.ItemsSource = viewModels;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When making relations between tables (in mysql), I have encountered a naming dilemma. For
As per https://stackoverflow.com/questions/3264227/relations-with-multiple-keys-in-doctrine-1-2 , I have two tables which (as I can't get it
I am migrating data from one model version to another in the iPhone, but
I have tree tables, Customer, Invoice and InvoiceRow with the standard relations. These I
I have a MySQL table named relations, as follows: from to count ------------- A
I have a MySQL table named relations, as follows: from to count ------------- A
I have a simple address book type of database. I've probably overnormalised, but it's
I have a litte problem with a mysql query. I use 5 tables: user_has_data
May a DTO have relations to other DTOs? Any more opinions on this topic
Imagine you have an entity that has some relations with other entities and you

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.