VS 2013 Controller Scaffolding Fails for the ApplicationUser Model (Multiple object sets per type are not supported)

后端 未结 8 2453
死守一世寂寞
死守一世寂寞 2020-12-08 11:07

In a VS 2013 RTM, MVC 5 project with EF 6, I tried to scaffold a controller based on the ApplicationUser (default with individual accounts authentication). Both Applic

8条回答
  •  难免孤独
    2020-12-08 11:50

    When you use scaffolding to generate control, vs will auto insert 1 line to your db context

    public System.Data.Entity.DbSet<...API.Models.ApplicationUser> ApplicationUsers { get; set; }
    

    Just delete that line, and in your controller. change db.ApplicationUsers to db.Users

提交回复
热议问题