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

  • Home
  • SEARCH
  • 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 4093924
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:40:46+00:00 2026-05-20T19:40:46+00:00

I’m currently writing an N-Tier architected ASP.NET system with a relatively normalised SQL database

  • 0

I’m currently writing an N-Tier architected ASP.NET system with a relatively normalised SQL database backend, but I’m struggling to get my head around how lookup values should be represented in my business objects (I don’t get the priviledge of using EF or ORMs). My table (as an example) could be structured like this:

CoreDataTable:

ID | Name  | Favourite_Colour
---|-------|-----------------
01 | Peter | 01
02 | John  | 03
03 | Mary  | 05

ColoursLookup:

ID | Colour | is_active
---|--------|----------
01 | Red    | 1
02 | Green  | 1
03 | Blue   | 1
04 | Pink   | 1
05 | Black  | 1

Now initially, I had created my business object to look like this:

public class Person
{
    protected int PersonID { get; set; }
    public string Name { get; set; }
    public int FavouriteColour { get; set; }
}

But what should I do when, for example, I want to list all the people in the database, along with their favourite colour? I can’t show just the lookup ID, so at the minute I see 4 options:

  1. Add a method to the class called Person.GetColourStringValue that gets the colour name from the database when called. This would be inefficient since using this method on 100 “Person” objects would result in 100 database queries.
  2. Have the FavouriteColour property of the Person object as a string, and do a reverse lookup whenever writing a person object to the database (i.e. take the colour name, and get the corresponding ID). This is dangerous IMO in the unlikely circumstance that two colours have the same name in the database.
  3. Store both the ID and the value in the Person object, and synchronise them whenever one or the other value is updating. This seems overly complex for a relatively trivial task.
  4. Create two representations, the Person object, and a PersonSummary object which pulls back a read-only version of the object, with all lookup values converted into their descriptive names.

I’m 100% convinced that I’m (a) overthinking this, and (b) making it more complicated than it needs to be. So, is there a preferred way of doing this? Or is there an option that I’ve overlooked? Any help is appreciated, I’ve been tackling this for hours now without coming to a decision.

Thanks.

  • 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-20T19:40:47+00:00Added an answer on May 20, 2026 at 7:40 pm

    The only proper way to answer this is to choose one, measure the impact (through a prototype if necessary), then compare that to the impact of the next option.

    Without knowing your system, I would say that option 1 is likely to be the best — IF you were to cache a series of Color objects so you didn’t need to head to the database each time.

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

Sidebar

Related Questions

No related questions found

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.