I am writing an Asp.net MVC app but I am not sure of a design decision. I am unsure if the best design would be to use enum values or store these values as lookup tables in the database. I can imagine lookup tables is fine for a windows app where all these queries are not a problem but for a high traffic web application running in the cloud that uses a relational database I am not so sure.
The application needs to be maintainable and will need to support multi language in future. Other developers are going to have to work on the system so I need the design correct and easily maintainable.
I currently use enums for values like
NotificationMethod (None, Email,Sms),
Gender (Male, Female)
OrderStatus (Open,Closed,InProgres, DeliveryInProgress
PaymentService (Cash, BankTransfer,Paypal, GoogleWallet)
enums suit me as there are business rules in the code linked to the enum and having business rules with enums values instead of strings make the application more readable and less prone to mistakes.
However the above is not suitable for the following scenario. My web frontend has a select/dropdown controls. To populate the dropdowns I have the following code
var paymentServices=
Enum.GetValues(typeof(PaymentService))
.Cast<PaymentService >()
.Select(d => new SelectListItem()
{
Text = d.ToString(),
Value = ((int)d).ToString()
}).ToList();
instead of the enum value Email I want to display E-Mail and I would want spaces between words.
So I end up using attributes and the use a static method in an EnumHelper Class to read the attributes as described here
My order and Preference db tables I have about 20 of these enums each per table.
For my scenario is it best practice to
Use only C# enums with enum attributes for display values like FriendlyNames, Description, Tooltip.
Just use database lookup tables. Disadvantage is business rules will have to be based on String values of the selected value that is in the lookup table. To go to my preference or order edit screens I would have to read 20 lookup tables separately in the database in order to render the dropdown controls. This makes writing code and reporting much easier but the system will be under heavy load (the system has thousands of users)
Have simple enums values for business rules and use matching lookup database tables and store in those tables the additional display columns to show on the frontend UI. The disadvantage is I have to keep the basic enum numbering in sync with the database lookup tables.
How do you I decide the best design decision or is there a better solution?