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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:00:37+00:00 2026-05-12T09:00:37+00:00

Suppose I want entries in the table Regions to have a type, e.g. a

  • 0

Suppose I want entries in the table Regions to have a type, e.g. a city, a country etc. What’s the accepted way of storing this type, assuming I’ll be using O/RM (NHibernate in my case) ? I see two options:

  • Have an enum in the C# bussines layer with the types and store the type as a tinyint in the table.
  • Have a lookup table RegionTypes with the type identifiers (strings or ints) and reference them in the Regions table.

The second approach seems more reasonable from the database point of view, since I have foreign key constraints, plus I can have additional data about the region types, e.g. a city is a child type for country (and since I’m using SQL Server 2008 spatial features, I actually need this information for spatial manipulations). However, looking from the C# point of view, I’ll basically have to have an entity RegionType and load it from the database every time i want to assign it to a region (as I understand NHibernate wouldn’t allow me to make the type an enum if I store it in a lookup table). This is a little tedious for such a simple task, knowing that region types are basically fixed and unlikely to change.

What about other types, like DayOfWeek which are unlikely to ever change or have additional properties, should they have their lookup tables and entities ?

  • 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-12T09:00:37+00:00Added an answer on May 12, 2026 at 9:00 am

    General rule is to use Enums if you are sure that set of values will never be changed by user. Otherwise it’s better to use lookup table.

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

Sidebar

Related Questions

Suppose I have a table with over a million entries and I want to
Suppose i have 1000 entries for altitude and longitude in coreData. i want to
suppose I have a table t and table t has 15000 entries suppose the
So suppose I have a bunch of blog entries and I want to find
Suppose one has a table of 1000 entries. We want to pick a random
Suppose I want to have a blog with Rails 3 on my website and
Suppose I have a table that contains valid data. I would like to modify
Suppose I have a table called 'test', into which there are three columns named
Currently I have two edit-text,suppose I want to make validation for empty edittext check.What
Suppose I have a function like this: public void AddEntry(Entry entry) { if (entry.Size

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.