我将MVC项目升级到EF4.3.1中的最新EF5。从那时起,我的数据库总是无法初始化。如果我将引用更改回EF4.3.1,一切正常。什么给了?
public class ArticleInitializer : DropCreateDatabaseAlways<ArticleContext>
{
protected override void Seed(ArticleContext context)
{
Config.Articles.ForEach(article => context.Articles.Add(article));
Config.Categories.ForEach(category => context.Articles.Add(category));
Config.CareerAreas.ForEach(careerArea => context.Articles.Add(careerArea));
context.SaveChanges();
}
}