Entity Framework 4.3 doesn't create database

前端 未结 2 1257
孤街浪徒
孤街浪徒 2020-12-18 04:44

I created new project and added the newest entity framework to it (version 4.3). I created classes and the context as in previous EF versions. However, during the very first

2条回答
  •  自闭症患者
    2020-12-18 05:22

    Could you try removing your constructor to make EF use it's default connection string.

    public Context() : base("MyConnection")
    {
    }
    

    Failing that, could you try updating your database from the Package Manager Console to see if you get any further information.

    Update-Database -Verbose
    

    Possibly unrelated in your case, but I get the same error when using MvcMiniProfiler 1.9. If you are using it too, make sure EF profiling is turned off by commenting out the line:

    //MiniProfilerEF.Initialize();
    

    Within the MiniProfiler App_Start.


    For others experiencing a similar issue, I have found that reenabling migrations from the Package Manager Console can help in certain cases. Make sure you have a copy of your Migration configuration before doing this.

    Enable-Migrations -Force
    

提交回复
热议问题