Lookup Tables Best Practices: DB Tables… or Enumerations

后端 未结 9 1826
忘掉有多难
忘掉有多难 2020-12-07 09:27

If we have to store the available positions at a company (i.e. Manager, Team Lead, ... etc). What are the best practices for storing it? I have two opinions with comments...

9条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-07 09:31

    If you can keep them synchronized I don't think there is much of a reason not to have both. When I was developing some state-machine functionality with a DB store it made things a lot easier to have an enumeration of the available object states within my IDE.

    I wrote myself a little EnumGenerator Visual Studio Addin a while back that creates an Enumeration code snippet in C# from a the ID and DESC columns of a DB Tablet you select from right within the IDE. I haven't released it because it was the first time I'd worked with VS Addins and it was pretty junky but I bet somebody with addin/code generation experience could take the idea and run with it.

提交回复
热议问题