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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:44:15+00:00 2026-05-11T07:44:15+00:00

We are using NHibernate, and one of the common patterns we have for storing

  • 0

We are using NHibernate, and one of the common patterns we have for storing enum-like information is to define separate tables for the enum, and just make a reference to the ID in the main entity/table that uses the enum. A simple example:

Message ------- ID (bigint PK) MessageTypeID (bigint FK) Body (varchar)  MessageType ----------- ID (bigint PK) Value (varchar) 

The MessageType table contains a small number of enum values like: SMS, MMS, PSMS, etc.

Is it worth putting enum values in separate tables like this? I guess the pro of the enum is that you can more easily extend it in the future and it’s more normalized, but the con is that you have to do a join every time you fetch a Message. Is there a breaking point where you would choose one over the other?

  • 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. 2026-05-11T07:44:16+00:00Added an answer on May 11, 2026 at 7:44 am

    Using enums implies to do not use another table as you are doing right now. It’s also faster as you said and so much simpler.

    In both cases you can add more options, but the question is: if you add another item in the table are you going to need to recompile the application to add such feature?

    I mean, if your application design is coupled and to support a new message type you need to recompile (maybe because you need to include the SMS implementation), it’s not worth it to have a separate table, and you should use enums

    On the other side, if either your entity lacks of logic (such a Countries, or States table), or your application can plug in a new message type without recompile you should use another table. For this, you could change your table to something like this:

    MessageType ----------- ID (bigint PK) Value (varchar) ImplementationType (varchar) (ie: Xyz.SMSSender, Xyz) 

    Or you could have a separated configuration file, where you can customize the injected dependencies.

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

Sidebar

Related Questions

I have a very simple scenario, using NHibernate: one abstract base class animal; two
i have read in more then one place that using NHibernate's Identifier as Primary
Odd one this. I am using NHibernate with one website. I have configured log4net
I'm using NHibernate 2.1.2, and would like to load a many-to-one association using a
I have the following classes which I would like to map using NHibernate class
I have one project using NHibernate 1.2. I know it's old, but I've used
Using POCO and Fluent NHibernate, I would like to have the ability to take
I'm using NHibernate for the first time and struggling. On web page one, I
I am trying to implement a one-to-many relationship using NHibernate 2.1.2 but keep getting
I'm using Fluent NHibernate auto mapping. I need to access more than one database

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.