We're working on an hospital information system that is being written on C# and using NHibernate to map objects to database. MVC pattern is being used to separate business logic from UI. Here is the problem,
How do you get variable sized different set of strings to UI?
For example a Contact
object have a property named City
that holds which city contact lives. In country that the app is written for has more than 80 cities. How could you write those cities to a combo box? (or a data grid, tables, ...) In this example the city number is fixed. There is no need to add another city for a long time. (If the city list changes, recompiling is not a problem)
For example a Contact
object have another property named FooBar
which is going to be hold 1000 different string values and these values is going to be selected from a combo box for that property. And this set can be grown if users want. How do you load the combo box with these values? (If the string list statically written to combo box object, recompiling is a problem)
I have different solutions as below
- All string values statically written to combo box in code or designer
- Get the values from a resource file
- Write those values to an XML file (Actually same as above, but no need to recompile)
- Make a
City
object and get the values into a list fromCITY
table with NHibernate - Make a class named
StringHolder
which has aType
andValue
property. All string values(includingCity
andFooBar
) would be written in just one table namedSTRINGHOLDER
. And get those values with a key like "CITY" or "FOOBAR" with NHibernate.
Which one would you choose? Or could you suggest me another one?
Thanks all