If I have an a dropdownlist bound to an enum, such as below, and I take the selected value and update my database record that is expecting an int, am I going to be thought of as lazy or ignoring the point of having an enum if I don’t cast the int to the corresponding enum value first?
I should probably mention that I am working with legacy code and they are not using classes to model each object, they are just updating the record in the db directly from the UI. No need to tell me why this is bad.
public enum Schedule
{
None = 0,
Hourly = 1,
Daily = 2,
Weekly = 3,
Monthly = 4,
}
I don’t see this as lazy. The names of an
enumare for our benefit. The database only cares about its value and that is what you are giving it.