I am someone that doesn't like converting Enums to strings....my biggest reason is it won't work with Dotfuscation. You will have to go through all your objects and exclude your enums from being dotfuscated. Enums are values, not strings....they shouldn't be used like strings. That's just me :)
I modified the nettiers templated to include a ColumnNames struct with each string: you can do the same if you like. The only bad thing about modifying the templates is you have to do it everytime you update the templates. I wish they would do it but they like the enums route. Again, just my way of skinning the same cat.
The syntax for once you have the generated object is Entity.ColumnNames.ColumnName. It works well for us.
Jeff
Table Script(goes in EntityInstanceBase.generated.cst file inside the class definition somewhere):
#region Column Name Struct
/// <summary>
/// List of columns and the string value for them.
/// </summary>
public struct ColumnNames
{
<% for (int x=0; x < cols.Count; x++) { %>
/// <summary>
/// <%= GetPropertyName(cols[x].Name) %> :
/// </summary>
public const string <%= GetPropertyName(cols[x].Name) %> = "<%= GetPropertyName(cols[x].Name) %>";
<% } %>
}
#endregion
View Script (goes in EntityViewBase.generated.cst):
#region Column Name Struct
/// <summary>
/// List of columns and the string value for them.
/// </summary>
public struct ColumnNames
{
<% for (int x=0; x < SourceView.Columns.Count; x++) { %>
/// <summary>
/// <%= GetPropertyName(SourceView.Columns[x].Name) %> :
/// </summary>
public const string <%= GetPropertyName(SourceView.Columns[x].Name) %> = "<%= GetPropertyName(SourceView.Columns[x].Name) %>";
<% } %>
}
#endregion
----------------------------------------------------------------------
Member of the .NetTiers team | Visit http://www.nettiers.com
----------------------------------------------------------------------