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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:06:10+00:00 2026-05-11T16:06:10+00:00

[UPDATE] Chosen approach is below, as a response to this question Hi, I’ ve

  • 0

[UPDATE] Chosen approach is below, as a response to this question

Hi,

I’ ve been looking around in this subject but I can’t really find what I’m looking for…

With Code tables I mean: stuff like ‘maritial status’, gender, specific legal or social states… More specifically, these types have only set properties and the items are not about to change soon (but could). Properties being an Id, a name and a description.

I’m wondering how to handle these best in the following technologies:

  • in the database (multiple tables, one table with different code-keys…?)

  • creating the classes (probably something like inheriting ICode with ICode.Name and ICode.Description)

  • creating the view/presenter for this: there should be a screen containing all of them, so a list of the types (gender, maritial status …), and then a list of values for that type with a name & description for each item in the value-list.

These are things that appear in every single project, so there must be some best practice on how to handle these…

For the record, I’m not really fond of using enums for these situations… Any arguments on using them here are welcome too.

[FOLLOW UP]

Ok, I’ve gotten a nice answer by CodeToGlory and Ahsteele. Let’s refine this question.

Say we’re not talking about gender or maritial status, wich values will definately not change, but about “stuff” that have a Name and a Description, but nothing more. For example: Social statuses, Legal statuses.

UI:
I want only one screen for this. Listbox with possibe NameAndDescription Types (I’ll just call them that), listbox with possible values for the selected NameAndDescription Type, and then a Name and Description field for the selected NameAndDescription Type Item.

How could this be handled in View & Presenters? I find the difficulty here that the NameAndDescription Types would then need to be extracted from the Class Name?

DB:
What are pro/cons for multiple vs single lookup tables?

  • 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-11T16:06:10+00:00Added an answer on May 11, 2026 at 4:06 pm

    I have decided to go with this approach:

    CodeKeyManager mgr = new CodeKeyManager();
    CodeKey maritalStatuses = mgr.ReadByCodeName(Code.MaritalStatus);
    

    Where:

    • CodeKeyManager can retrieve CodeKeys from DB (CodeKey=MaritalStatus)
    • Code is a class filled with constants, returning strings so Code.MaritalStatus = “maritalStatus”. These constants map to to the CodeKey table > CodeKeyName
    • In the database, I have 2 tables:
      • CodeKey with Id, CodeKeyName
      • CodeValue with CodeKeyId, ValueName, ValueDescription

    DB:

    alt text http://lh3.ggpht.com/_cNmigBr3EkA/SeZnmHcgHZI/AAAAAAAAAFU/2OTzmtMNqFw/codetables_1.JPG

    Class Code:

    public class Code
    {
        public const string Gender = "gender";
        public const string MaritalStatus = "maritalStatus";
    }
    

    Class CodeKey:

    public class CodeKey
    {
        public Guid Id { get; set; }
        public string CodeName { get; set; }
    
        public IList<CodeValue> CodeValues { get; set; }
    }
    

    Class CodeValue:

    public class CodeValue
    {
        public Guid Id { get; set; }
    
        public CodeKey Code { get; set; }
    
        public string Name { get; set; }
        public string Description { get; set; }
    
    }
    

    I find by far the easiest and most efficent way:

    • All code-data can be displayed in a identical manner (in the same view/presenter)
    • I don’t need to create tables and classes for every code table that’s to come
    • But I can still get them out of the database easily and use them easily with the CodeKey constants…
    • NHibernate can handle this easily too

    The only thing I’m still considering is throwing out the GUID Id’s and using string (nchar) codes for usability in the business logic.

    Thanks for the answers! If there are any remarks on this approach, please do!

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

Sidebar

Related Questions

UPDATE: I've been playing around with this more, and it seems like tmux's clear-history
UPDATE : My original question wasn't quite clear. I'm looking for the name of
Update: I reported this as a bug to Apple and they fixed it! All
Update : This is no longer an issue from C# 6, which has introduced
Update : I found almost exact similar question , yet it has slightly different
Update: Originally, this post was using Books as the example entity, with Books1 ,
I can get my ManyToManyField into a chosen widget directly by using the chosen
I have replaced chosen replaced and inserted dom elements this way: $(.editLink).click(function () {
I'm looking for a way to update my progress bar while copying a file
I tried solving my problem using this link update - I figured out that

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.