Y Haber
Y Haber

Reputation: 318

How to get enums working in mvc4 with Entity Framework 5 Beta 2?

I used Nuget to update to Entity Framework 5.0.0-beta2 in my MVC3 -> MVC4 project.

I'm trying to get the enums to work, and each migration I add just ignores the enum fields.

I found this in the web.config:

  <configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />

How do I get this reference updated to EF5?

Is that what I need to get enums working?

Upvotes: 5

Views: 1524

Answers (2)

Y Haber
Y Haber

Reputation: 318

I found the answer to this on Julie Lerman's blog.

The solution is to remove the EF5 Nuget package, update the app to target .net 4.5 and then add the Nuget for EF5 Beta back in. Apparently when you are targeting .net 4.0 the Nuget package will add EF4.4 instead of 5.

Upvotes: 7

oruchreis
oruchreis

Reputation: 866

Check the Project Target which must target .NET 4.5 not .NET 4.0. Even if you are in VS 11, EF 5 needs .NET 4.5.

Upvotes: 2

Related Questions