Fet*_*che 2 sql-server dac sql-server-data-tools
编辑:更新为状态它没有挂起,只需要年龄!
我正在尝试使用dacpac更新现有的sql server数据库.
我可以使用下面的(剥离)示例在30秒内创建一个新的SQL Server数据库.我遇到的问题是使用相同的dacpac,重新运行程序(因此它更新现有数据库而不是重新创建)需要20分钟.
如果时差到期是什么呢?全面使用了redgate的SqlCompare后,我觉得时间不容乐观.
部署方法的第三个参数是UpgradeExisting,我将其设置为true - 这是我需要做的还是我错过了什么?
void Deploy(string TargetConnectionString, string TargetDatabaseName, string pathToSourceDACPAC)
{
DacServices dacServices = new DacServices(TargetConnectionString);
//Set up message and progress handlers
dacServices.Message += new EventHandler<DacMessageEventArgs>(dbServices_Message);
dacServices.ProgressChanged += new EventHandler<DacProgressEventArgs>(dbServices_ProgressChanged);
//Load the DACPAC
DacPackage dacpac = DacPackage.Load(pathToSourceDACPAC);
//Set Deployment Options
DacDeployOptions dacOptions = new DacDeployOptions();
dacOptions.AllowIncompatiblePlatform = true;
//Deploy the dacpac
dacServices.Deploy(dacpac, TargetDatabaseName, true, dacOptions);
}
//Event handlers...
void dbServices_Message(object sender, DacMessageEventArgs e)
{
OutputThis("DAC Message", e.Message.ToString());
}
void dbServices_ProgressChanged(object sender, DacProgressEventArgs e)
{
OutputThis(e.Status.ToString(), e.Message.ToString());
}
Run Code Online (Sandbox Code Playgroud)
注意,程序会在dacServices.Deploy行中消失到以太网中.
好的,在运行调试器(VS2012)时遇到了愚蠢的时间.编译完成后,在选择Memory DacSchemaModelStorageType时,时间为25秒左右,在选择File DacSchemaModelStorageType时,时间为45秒左右.
我想这只是意味着调试是一个痛苦的whatsit!
| 归档时间: |
|
| 查看次数: |
4327 次 |
| 最近记录: |