c# - Should static data be stored in a database or in the application -


i'm working on software @ them moment , i'm not sure route take this. have data never change, , has hierarchical relationship, , used populate display. there reasonably amount of data.

i have following options:

1.a set of enums/objects 2.an xml file 3.the embedded sqlite database

in particular case think enums correct way, smell data being embedded in code that. need data hierarchy purpose , , using enums bit trouble.

the database should provide less of performance hit , easy use, seems overkill static data.

which correct design path here?

despite format here, isn't "answer"; it's more series of questions need answer yourself, in choosing how represent data.

in (way many years of) experience, "static data never change" never static. argue storing data in form not require source code changes, rule out enums.

example:

i developed system determining best way cut animal carcasses, based on weight , breed of available carcasses, , incoming order stream. 1 of key inputs decision process description of anatomy of animals, identifying cuts of meat derived muscle groups, , therefore parts left once take out particular cut. information hierarchical in nature.

you think information quite static; after all, anatomy of animals not change. in fact, found needed enhance data once every 6 months, adding descriptions of new ways cut.

because thought of data static, described in xml file , read in @ start of program. editing data in form cumbersome , error-prone. if had over, have chosen different storage form.

consider need program if static data change. need add new decision logic , new types, or strictly matter of changes in relationships among existing objects? how debug data? maintain data in source control?

i give consideration way(s) in want access data. more flexibility need in searching it, better argument database of kind. @rbaghbanli's point well-taken; decision might based on platform code run.


Comments