asp.net - Model a fixed list of options: enum, class or constants? -
i'm using asp.net , entityframework , trying model class "car" has property "category" category string fixed list of options, e.g. "new car", "oldtimer". display available categories in dropdown. not sure how model this:
enum: category string, guess enums don't work here, though perfect dropdown
constants: strings, inconvenient create drop down from
class property "name": seems convenient
is best practice use class?
yes, should use class model category. enums , constants may have trouble when doing queries cannot used directly when using linq, instance.
Comments
Post a Comment