Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework CTP 5 - Code First Mappings - Can't map properly an enum list

I have the following

[DataContractAttribute]
public class Animal
{
    [Key]
    [XmlElement(ElementName = "Id")]
    [DataMember()]
    public Guid Id
    {
        get;
        set;
    }

    [XmlElement(ElementName = "AnimalType")]
    [DataMember()]
    public List<AnimalType> AnimalType
    {
        get;
        set;
    }
 }

And i map it through the code first approach with EF to tables

  modelBuilder.Entity<Animal>().ToTable("Animal");

As you see I have not performed some complex mapping, but the List of AnimalType enumerations did not get mapped automatically to any columns/tables in the DB. Do i need to add some extra code to the model builder to control the mapping of an enumeration list ?

like image 615
Faris Zacina Avatar asked Jun 25 '26 19:06

Faris Zacina


1 Answers

As of EF CTP5, enums are not supported yet. The team announced that they are going to fully support enums in their next RTM version which is targeted to be released on the first quarter of 2011.

like image 153
Morteza Manavi Avatar answered Jun 28 '26 17:06

Morteza Manavi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!