Best way to store enum values in database - String or Int
- by inutan
Hello there,
I have a number of enums in my application
which are used as property type in some classes.
What is the best way to store these values in database, as String or Int?
FYI, I will also be mapping these attribute types using fluent Nhibernate.
Sample code:
public enum ReportOutputFormat
{
DOCX,
PDF,
HTML
}
public enum ReportOutputMethod
{
Save,
Email,
SaveAndEmail
}
public class ReportRequest
{
public Int32 TemplateId
{
get { return templateId; }
set { templateId = value; }
}
public ReportOutputFormat OutputFormat
{
get { return outputFormat; }
set { outputFormat = value; }
}
public ReportOutputMethod OutputMethod
{
get { return outputMethod; }
set { outputMethod = value; }
}
}