我使用EF 6.我现有的代码是:
public void CreateOrUpdateCompanyDb(string companyDbName)
{
try
{
string connectionString = _connectionStringProvider.GetConnectionString(companyDbName);
DbMigrationsConfiguration cfg = CreateMigrationsConfig(connectionString);
cfg.AutomaticMigrationsEnabled = false;
cfg.AutomaticMigrationDataLossAllowed = false;
DbMigrator dbMigrator = new DbMigrator(cfg);
dbMigrator.Update();
}
catch (MigrationsException exception)
{
_logger.Error(string.Format("Error creating company database '{0}'",companyDbName), exception);
}
}
Run Code Online (Sandbox Code Playgroud)
连接字符串如下:
Server=tcp:xxx.database.windows.net,1433;Database=companyDbName;User ID=xxx@xxx;Password=xxx;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;"
Run Code Online (Sandbox Code Playgroud)
这为特定公司创建了数据库.但问题是创建的数据库来自现已退役的网络版,但我想创建基本/标准/高级版.
我应该如何操作连接字符串,以便数据库的版本是所需的?
entity-framework ef-code-first ef-migrations entity-framework-6 azure-sql-database