Reference data or lookup tables are things like CustomerType, ProductType, etc. They change infrequently, occasionally a new type is added or the old resigned. In the code, they are often reproduced as enums / constants, and are also used to fill combo boxes. Adding a new type should not violate existing applications, and most often these new types are necessary only to support the functions of the new application, legacy applications should ignore it.
This situation will be familiar in most online stores, after a few years / months it is messy, uncontrollable, and if the database and code fail, bad things happen.
How do others deal with this problem? What does the code / DB look like and how is it executed by the version?
Do you mean that identifiers and tags are hardcoded in the code and displayed in the lookup table in the database?
The approach we have taken is to read identifiers and labels of type "from" and use them to populate lists.
(Fortunately) I didn’t have to support different versions of the application, which should read different sets of values from the same lookup table.
, . (, 1.5) 1.5 . , (, 2.1), .
, , .
, , , , . , , : ( ) . enum , ( , , ..).
, ; , " ", "", , . enum ; , , , SQL-. , "primaryColors()". ; .
public static Color valueOf(int key);
; .
if (selectedColor == Colors.RED) { . . . }
, , : , , , - ..
, , , , .
Source: https://habr.com/ru/post/1703153/More articles:Как обращаться с разными типами пользователей? - phphttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1703149/how-to-map-2-tables-to-an-entity-in-net-entity-framework&usg=ALkJrhg6StzOs63RThSMS6VexueomlZIXwToolStripProfessionalRenderer for Visual Studio 2008 Look-and-Feel - user-interfaceHow to change \ para formatting in LaTeX - latexVarious configuration files for development and production in an ASP.NET application - asp.netHow to split an attribute with values separated by a character into separate elements - xmlUnitOfWork implementation - design-patternsСуществуют ли какие-либо гарантии программного обеспечения в критических системах? - algorithmAn HTTP message in a C # console application does not return the same as a browser request - httpA regular expression returning a constant value as part of a match - c #All Articles