Add Controller in MVC4 not working

前端 未结 11 582
一向
一向 2020-11-30 08:58

I\'m using VS 2010 Premium. I have a MVC4 project using SqlCe 4.0 with a entity framework model.

Model is:

  public class ProjectBuild
    {
       p         


        
11条回答
  •  温柔的废话
    2020-11-30 09:34

    You should always initialize the superclass with base(string). Also found out that the name of connectionString in Web.config may not be same as the String you send to the super class contructor.

    So for example :

    
    
    public class MovieDBContext : DbContext
    {
       public MovieDBContext() : base("Movie") { }
    }
    

    So you see, the "MovidDBContect" is different from "Movie".

提交回复
热议问题