Are Enums supported in EF 4.2 CTP in VB.NET using code first? RRS feed

  • Question

  • The TechEd 2011 Dev312 video showed, that a simple Public Enum XYZ definition with a list of values should be enough to create a database lookup table.

    However If I define the enum and use it in a class property using VB.NET and EF 4.2 code first,  no table for the enum is created, no error message is given. The property of type XYZ is simply not created in the DB. Using a <Required> annotation doesn't help either.

    This is the domain class:

    Public Enum Gender
        Male = 1
        Female = 2
    End Enum
    Public Class Person
        Public Property Id As Integer
        Public Property Name As String
        Public Property FirstName As String
        Public Property Gender As Gender
    End Class

    This is the context class:

    Public Class PersonContext
        Inherits DbContext
        Public Property Persons As DbSet(Of Person)
    End Class

    please advice. thank you very much.

    • Edited by herbertf Tuesday, January 3, 2012 5:56 PM
    Sunday, January 1, 2012 6:22 PM

All replies

  • Enums are not supported in EF 4.2


    Wednesday, January 4, 2012 9:44 PM