I\'m using VS2013
When I try to create an \"MVC 5 Controller with views using entity Framework\" I get the following error:
the
If you trying to create a Odata controller
Go to DbContext class and then check whether
public System.Data.Entity.DbSet<BackEnd.Models.OrganizationType> YourModel{ get; set; }
Available ior not
If yes .. remove it and then retry
Re-Try after deleting below line from your EFDbContext class.
public System.Data.Entity.DbSet<WebApplication.Domain.Entities.Product> Products { get; set; }
Example:
For me, I have to "run custom tool" by right click on model.tt and model.context.tt files, then error got resolved.
Problem may be because of missing [NotMapped]
Attribute in one of the model class.
As I missed the attribute and I was cunning my head.
[Display(Name="Logo")]
[DataType(DataType.Upload)]
[NotMapped]
public HttpPostedFileBase Logo { set; get; }
In my case, but using VS 2017, this occurred when I had all my model classes defined within a single .cs file. Once I separated each class out into its own file the generation process completed correctly.
public class EFDbContext : DbContext
{
public DbSet<Product> Products { get; set; }
}
Forgot the { get; set; }... all works now #crying