Should I store Enum ID/values in the database or a C# enumeration?

后端 未结 4 765
感情败类
感情败类 2021-01-11 14:35

Say my database tables have columns like UserType, SalesType, etc.

Should I have database tables with UserTypeID, userTy

4条回答
  •  無奈伤痛
    2021-01-11 15:01

    In my projects, I use my application dbscript to generate C# consts from database, so code always matches db values.

    Of course, you only need to have C# enums if your code does something specific depending on the value of the Type field.

提交回复
热议问题