Scaffolding controller doesn't work with visual studio 2013 update 3 and 4

c# entity-framework visual-studio

Question

Im unable to scaffold a controller (MVC5 Controller with views, using Entity Framework) in Visual studio 2013 (update 3 and 4). The error message is below:

There was an error running the selected code generator:

A configuration for type 'Library.Morthwind.Models.Catgeory' has already been added. To reference the existing configuration use the Entity<T>() or ComplexType<T>() methods

I have created the models by selecting 'Reverse Engineer Code First' from the 'Entity Framework Power Tools Beta 4' Tool menu.

Any ideas about what might cause this error?

1
42
12/12/2014 3:43:40 PM

Popular Answer

I had the same issue today.

I had added some custom configuration for one of my Model classes to add a relationship using the fluent API. This was specified in my dbContext class in the OnModelCreating override using the following:

modelBuilder.Configurations.Add(new OrderConfiguration());

Commenting out the above line allowed the Controller scaffolding to run as expected.

VS 2013 update 2 had a problem with this and the scaffolding came up with an unhelpful error with no further information. In installed Update 3 and it gave just enough detail to track down the underlying issue.

Jeff.

40
8/7/2014 9:43:43 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow