Sean Kearon
Sean Kearon

Reputation: 11427

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();

Upvotes: 6

Views: 4128

Answers (2)

Ladislav Mrnka
Ladislav Mrnka

Reputation: 364249

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.

Upvotes: 9

marc_s
marc_s

Reputation: 754210

No.

The enum support and many more features were included in the "June 2011 CTP" preview (see announcement) - but those require changes to the EF core and those will be shipped later.

EF 4.2 is only a few bugfixes and smaller changes - see ADO.NET team blog announcement.

What’s Not in This Release?

As covered earlier this release is just a small update to the DbContext & Code First runtime. The features that were included in EF June 2011 CTP require changes to the Core Entity Framework Libraries that are part of the .NET Framework and will ship at a later date.

Upvotes: 2

Related Questions