Edit: Updated to state it isn't hanging, just takes AGES!
I'm trying to update an existing sql server database using a dacpac.
I can create a new SQL server database with the (stripped down) example below in 30 seconds. The issue I'm having is that using the same dacpac, rerunning the procedure (so it is updating an existing database rather than creating afresh) takes 20 minutes.
Is this kind if time difference what is to be expected? Having used redgate's SqlCompare comprehensively, I'm finding the time unpaletable.
The third param of the deploy method is UpgradeExisting which I'm setting to true - Is this all I need to do or am I missing something??
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());
}
NB the program disappears into the ether on the dacServices.Deploy line..
OK, the silly times were experienced while running through the debugger (VS2012). Once compiled the times were 25 or so seconds when chosing the Memory DacSchemaModelStorageType, or 45 or so seconds when chosing the File DacSchemaModelStorageType .
I guess this just means that debugging is a pain in the whatsit!
If you are finding it much slower under a debugger, do you have many warnings?
Warnings are generally generated by the antlr parser it uses and the parser throws exceptions which are very expensive.
Work to fix the warnings and the build time should come down.
Ed
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With