Manually editing database in code first entity framework

后端 未结 4 1559
没有蜡笔的小新
没有蜡笔的小新 2021-02-13 18:55

I have been trying out EF 4.1 (code first) with MVC 3. I am thinking ahead to when the application will need changes. I tested a couple of scenarios. I like the

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-13 19:35

    I know this has been marked as solved but in my case it didn't do the trick.

    Once I deleted dbo.EdmMetadata I was getting a different error:

    Model compatibility cannot be checked because the database does not contain model metadata. Ensure that IncludeMetadataConvention has been added to the DbModelBuilder conventions.

    The way it worked for me was to remove the Initializer class from Application_Start:

    void Application_Start(object sender, EventArgs e)
    {
        // MyDB.SetInitializer(new MyInitializer());
    }
    

提交回复
热议问题