I am getting an error I've never seen before in EF6 (5 or 4).
Method not found: 'System.Data.Entity.ModelConfiguration.Configuration.PrimitivePropertyConfiguration System.Data.Entity.ModelConfiguration.Configuration.PrimitivePropertyConfiguration.HasDatabaseGeneratedOption(System.Nullable`1)'.
public class AuthorizeAttribMap : EntityTypeConfiguration<AuthorizeAttrib>
{
public AuthorizeAttribMap()
{
// TAttrib //
this.HasKey(x => x.Id);
// Properties
this.Property(t => t.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
this.Property(t => t.ControllerName)
.IsRequired()
.HasMaxLength(100);
this.Property(t => t.ActionName)
.HasMaxLength(100);
// Table & Column Mappings
this.ToTable("AuthorizeAttrib");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.ControllerName).HasColumnName("ControllerName");
this.Property(t => t.ActionName).HasColumnName("ActionName");
}
}
What am I missing?
Found the "problem", or at least a fix - and I hate it!
Solution contains 22 projects and growing. We do not have DI in place for separation of concerns all of the way through our stack yet. EF references have crept up the stack giving us 16 projects referencing EF. We use TFS 2013 for source control.
After multiple check ins and gets, one of the projects appears to have picked up an older EF reference. (Really? How?) By using Nuget for the solution I removed ALL EF packages (Nuget reported all projects using the same version). Closed VS, Reopened, Added EF Nuget back to all projects, fixed references where projects broke (makes them go missing in other projects). Recompiled, ran. It all works now.
We've seen this same type of error once before with NewtonSoft.JSON.
TFS is driving me nuts with this apparent switching of Nuget references.
The fix: Remove all, add all EF Nuget references.
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