I need to use EF5 on .NET 4 and I've run into a reference issue when mapping my class with HasDatabaseGenerationOption.Identity which doesn't exist in the 4.0 version of the library.
The following is failing:
this.Property(t => t.DeploymentLogId)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
Does anyone know of a work around?
Using NuGet to add EntityFramework to a project that targets .NET 4.5, will add EntityFramework 5.0.
If you later change the project to target .NET 4.0, EntityFramework 5.0 is still referenced.
To fix it, use NuGet to uninstall EntityFramework and add it back, also in NuGet. This will add EntityFramework 4.4 which is the last supported version for .NET 4.0.
If it still does not work there may be some references to the specific EF version in App.config
. These can be removed.
The namespace changed in EF 5.0. Try adding this:
using System.ComponentModel.DataAnnotations.Schema;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With