EntityFramework 6.0 CreateDatabaseIfNotExists Code first to create database

前端 未结 2 1684
广开言路
广开言路 2020-12-29 12:13

What am I doing wrong. I have got a user DbContext setup and working when I originally created the Code-First with powershell it all worked fine.

I implemented Data

2条回答
  •  遥遥无期
    2020-12-29 12:47

    Finally figured the solutions, not sure why or what. Changed my Database initializer to MigrateDatabaseToLatestVersion instead of CreateDatabaseIfNotExists worked.

    Database.SetInitializer(new MigrateDatabaseToLatestVersion());
    

提交回复
热议问题