Here is a model:
Public class Person
{
[Key]
Public int PersonId { get; set: }
Public int Age { get; set; }
Public ColorEnum FavoriteColor { get; set; }
}
Public Enum ColorEnum
{
Red = 1,
Green = 2,
Blue = 3
}
Is it possible for Entity Framework Code First to use the Person model to generate the corresponding table? What about the ColorEnum type?
Thanks
EF 4.3 doesn’t support Enums. But is has been announced that
Enumsupport is coming with EF 5, which is due out alongside .NET 4.5. To handle enums with Code-First currently you’ll do something like the following: