The enumeration would be named after the table that records were pulled from. And the actual enum entries would be the records.
Basically these tables are my reference tables and all my data records are dependent to these reference tables.
For example a User table might have the following fields
UserTable
- UserID (int)
- UserName (string)
- Password (string)
- UserTypeID (foreign key)
UserTypeReference
- UserTypeID (int)
- UserTypeName (string)
- UserTypeDesc (string)
Now inside UserTypeReference I have the following records:
0,”LDAP”,”User account is held on the Domain Server”
1,”Local”,”User account is held on the local machine”
Therefore when I run my EnumGeneration I would get the following enum
enum UserTypeOption
{
///<summary>
/// User account is held on the Domain Server
///</summary>
LDAP = 0,
///<summary>
/// User account is held on the local machine
///</summary>
Local = 1
}
So on my code instead of checking for a record on the number I would use the enum to do it:
Example:
Public void IsLDAP()
{
/// no need to compare against 0.
return (UserEntity.UserTypeID == UserTypeOption.LDAP);
}
I would like to do a one point of modification for all enumerations
When someone create a new table or modifies the tables I can run LLBLGen against the database, recompile my code and run it. At the end I will have a nice set of enums that are based on the database reference tables. One point of modification, instead of having to add new entries to the database and then having to modify my enums.
Did this clear things up?
Let me know if you have any more questions.
Thank you,
BV