I have one question about manipulating with data in database.
I have tables like this:

The question is, what kind of data should I keep in Status table in it’s Name property?
I have two possibilities:
- Keep there
strings, for example: ‘Normal’, ‘Hired’, ‘Banned’, ‘Moderator’ etc. - Keep there
ints, corresponding toEnumtype in my project, also containing all those ‘Normal’, ‘Hired’, etc.
Is there any rule about it? I saw the second option(enum) in one project, and the author justified his choice, with the fact, that it’s easier for him, to parse those int’s to managed code, just with this line:
(StatusEnum)statusInt;
In my opinion, the first option(strings) is more professional, because the database is more independent. But actually I don’t know how to argue, because it only brings me a problem: I have to parse those strings to managed Enum type with two lines (Enum.TryParse...).
Can somebody please, give me their opinion?
If you go with enum you don’t need a special table for that. You will simply use Status integer value in
Usertable and map it to enum directly in EF designer. Related table makes sense if yourStatusis an entity. Is it something you can change, you can add or delete at runtime? If yes make it a table with string name. If no make it an enum field inUsertable.