When I scaffold a view from my model, my Enum is ignored unless a specify a Data Context Class? Why is this?
Here is my model:
public class customer
{
public int customerId { get; set; }
public Title customerTitle { get; set; }
public string CustomerName { get; set; }
}
public enum Title
{
Mr, Miss, Mrs, Ms
}
When I scaffold a create view and specify a Data Context Class I get this in my view:
<div class="form-group">
@Html.LabelFor(model => model.customerTitle, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EnumDropDownListFor(model => model.customerTitle, htmlAttributes: new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.customerTitle, "", new { @class = "text-danger" })
</div>
</div>
But if I scaffold the same model again but without a Data Context the Enum isn't there at all.
This is where I do or do not specify a Data Context Class.