Tables vs Enums


Reddit discussion - https://www.reddit.com/r/dotnet/comments/1n97jz7/ef_when_to_use_seperate_table_and_when_to_use_enum/
An interesting question popped up on Reddit about when to use tables and when to use enums. I often find myself pondering this too when designing applications. Here's the general consensus from Reddit:
Go with enums when the values stay pretty constant. They're also great if you have some logic tied to them.
Opt for tables when users need to add, update, or delete values. Since these values might change over time, it's best not to have logic rules connected to them.
There's also a chat about how to sync enum values with a database table using Entity Framework Core. I've been on the hunt for a neat solution to this, but I haven't found a great one yet. Looks like I've got something interesting to explore in my free time!
Subscribe to my newsletter
Read articles from Code Barista directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
