Can't Add View from Controller in VS 2015 : “There was an error running the selected code generator”

前端 未结 21 2362
独厮守ぢ
独厮守ぢ 2020-11-27 18:34

I\'m following a video tutorial where I\'m required to create an empty ASP.NET Web Application with MVC, using Visual Studio 2015, bei

21条回答
  •  清歌不尽
    2020-11-27 19:13

    My problem was the Types used in the Model Class.

    Using the Types like this:

        [NotMapped]
        [Display(Name = "Image")]
        public HttpPostedFileBase ImageUpload { get; set; }
    
    
        [NotMapped]
        [Display(Name = "Valid from")]
        public Nullable Valid { get; set; }
    
    
        [NotMapped]
        [Display(Name = "Expires")]
        public Nullable Expires { get; set; }
    

    No longer works in the Code Generator. I had to remove these types and scaffold without them, then add them later.

    It is silly, [NotMapped] used to work when scaffolding.

    Use the base Types: int, string, byte, and so on without Types like: DateTime, List, HttpPostedFileBase and so on.

提交回复
热议问题