-
public oaEntities()
-
: base("name=MyStrConn")
-
{
-
//策略一:数据库不存在时重新创建数据库
-
//Database.SetInitializer<oaEntities>(new CreateDatabaseIfNotExists<oaDbContext>());
-
//策略二:每次启动应用程序时创建数据库
-
//Database.SetInitializer<oaEntities>(new DropCreateDatabaseAlways<oaDbContext>());
-
//策略三:模型更改时重新创建数据库
-
//Database.SetInitializer<oaEntities>(new DropCreateDatabaseIfModelChanges<oaEntities>());
-
//策略四:从不创建数据库
-
Database.SetInitializer<oaEntities>(null);
-
}