c# - Syncing referential integrity tables and enums -
I think this question periodically, so I thought I would ask you about it.
Suppose my database table looks like this:
Table: Visibility ID value - ----- 0 visible 1 invisible 2 collapsed
This is a table to ensure only one table. It is basically an enumen stored in the database for the purpose of ensuring that any visibility values that appear in other tables, Are always valid.
At the end of my face, I have some options.
- I can ask this table and give it a
dictionary & lt; String, int & gt;
ordictionary & lt; Int, string & gt; I can store in
. -
I can write an ANM manually and only manually edit the value in rare event that there is a change in the table. E.g.,
Public Enum Visibility {visible, invisible, collapsed}
- Something else ????
What would you advise and why?
Thank you. This kind of fairly trivial stuff for me, I usually go with an enum, I like this with you. I can recognize that I think it is not entirely right ... but in my opinion it is less than two evils.
Some additional justification for this: If for some reason to add the fourth value, your code will need to be updated in any way so that it can be able to handle it. When you are on it, there is also little difficulty in updating the NM.
Comments
Post a Comment