Cannot add Scaffold > MVC Controller with views, using Entity Framework in Asp.NET Core

我怕爱的太早我们不能终老 提交于 2019-12-10 12:15:35

问题


When I try to add Controller using build-in generator I get following error message:

Where "Brand" is a model class and "ApplicationDbContext" is my data context class.
I never encoutered error like this before. It does not occur all the time (2 success vs 30-40 attempts without changing single line of code). I was able to create Controller for same class minutes ago, but it's really annoying when you try to add something new and try more than 10 times with no results.
Of course, I could write my own controller and views, but I really like using included tools.
I have already repaired VS using "Modify" option in "Add or remove". I'm using latest Microsoft Visual Studio Community (MVSC2015 V14.0.25425.01 Update3).
EDIT:
Brand.cs:

namespace AppBrander.Models  
{  
    public class Brand  
    {  
        public int ID { get; set; }  
        public string Email { get; set; }  
        public string BrandName { get; set; }  
        public string CompanyName { get; set; }  
        public string Description { get; set; }  
    }  
} 

Works in brand new project, fails in old - I guess it's just my VS installation being totally messed up. I should have been guessed, but I just did second repair...

来源:https://stackoverflow.com/questions/38869883/cannot-add-scaffold-mvc-controller-with-views-using-entity-framework-in-asp-n

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!