Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework 4.2 enum support

Does EF 4.2 Code First have support for enum types? If so, how do you use it? The following does not create a field for the enum property when using the Nuget EntityFramework package.

public class FooContext : DbContext
{
    public IDbSet<Foo> Foos { get; set; } 
}

public class Foo
{
   public int Id { get; set; }
   public string Name { get; set; }
   public Category Category { get; set; }
}

public enum Category {One, Two, Three }

var db = new FooContext();
db.Foos.ToList();
like image 768
Sean Kearon Avatar asked Nov 02 '11 08:11

Sean Kearon


1 Answers

EF team has changed versioning so EFv4.2 is not final release of June 2011 CTP. Features from June 2011 CTP should be released as part of .NET Framework 4.5.

like image 187
Ladislav Mrnka Avatar answered Sep 30 '22 11:09

Ladislav Mrnka