oop - C# Enums vs Data driven lists -
i trying figure out best way go design enum. let's have class , enum:
public enum actiontype { acceptable = 1, unacceptable = 2, pendingreview = 3 } public class report { public actiontype action { get; set; } }
let's have database table stores different action types:
id action 1 acceptable 2 unacceptable 3 pendingreview
if want add type of action @ later day have update enum , redploy assemblies. love way enums reduce errors, make code easier read , ensurance of forward compatibility. efficient way of hadeling new action types?
thanks!
i have had same problems have , have tried use enums as possible because make readability quite bit easier.
the approach have used redundant, have created lookup table , have used mirror enum in code. problem using enums have statuses saved in db confusing such , have discerned documentation. problem db approach code readability hampered , have totally unreadable statements if (status == 2) ...
also, if enum item added program flow change , code have updated anyways. makes pretty irrelevant. deployment strategies clickonce make deployment trivial.
Comments
Post a Comment