Hello Pete,
Let me better explain what I am looking for.
I have a few SQL Lookup tables: Roles, ...
Usually each table has two columns: ID and NAME.
Consider, as an example, the following:
- Table ROLES with columns ID, NAME and PERMISSIONS.
This one has a rare third column. So I would use:
public enum Roles {
[Permissions("WRD"]
Administrator = 1,
[Permissions("WD")]
Collaborator = 2
}
On my application I would use Roles enumeration.
This would help me avoiding typing problems and so on ...
I always need on my application two fields:
The ID and the NAME. So that is quite close to ENUM.
If I have a need for an extra column I add it as an attribute.
Sometimes the application (usually a web site) is localized.
So my SQL Roles table has 2 or more localized version ...
I would like my Enums to have some kind of localization.
For user display but also for the application usage such as:
EN: /posts/list?r=administrator
PT: /posts/list?r=administrador
I have other lookup tables such as Categories, ...
But those one are dynamic. So they values change.
I am using enumerations only on those tables which do not change and which have influence on how the application behaves, looks, ... Like the User Roles.
I am not sure if ENUM is the best option ... What do you think?
And in relation to translation I can use:
_service.Translate(Roles.Administrator.ToString(), PT).
This would translate the Administrator string to portuguese from the default enum language which is english ...
Maybe this is better instead of integrating the translation completely in the TypeConverter ...
Thank You,
Miguel