发布dacpac使用Microsoft.SqlServer.Dac.DacServices单用户模式 [英] Publish dacpac in single user mode using Microsoft.SqlServer.Dac.DacServices

查看:333
本文介绍了发布dacpac使用Microsoft.SqlServer.Dac.DacServices单用户模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要发布DAC PAC在单用户模式,以防止不必要的分贝的变化,而数据库升级。对于我已经使用部署功能的 Microsoft.SqlServer.Dac.DacServices

I want to publish dac pac in single user mode to prevent unnecessary db changes while database is upgrading. For that I have used Deploy function in Microsoft.SqlServer.Dac.DacServices.

这功能有一个说法DacDeployOptions选项。我已经在选项中设置 DeployDatabaseInSingleUserMode = TRUE 。即使它被设置为true,我能够做的DB操作,而dacpac正在部署。

That function there is a argument DacDeployOptions options. I have set DeployDatabaseInSingleUserMode = true in that options. Even though it is set to true I am able to do db operation while dacpac is deploying.

有什么我失踪?或是否有任何其他的方式来实现这一目标。

Is there anything I am missing? or Is there any other way to achieve this.

帮助将不胜感激!

推荐答案

哪个版本DacFX您使用的是?如果不是最新的,最好的获取最新的,因为很多旧的都没有认识到你指定的选项非常好。

Which version of DacFX are you using? If it's not the latest, best get the latest, because a lot of the older ones are not very good at recognizing the options you specify.

另外,你可以这样做(这是我做了什么,而不是试图让DacFX正常工作。

Alternatively, you could do this(It's what i've done, instead of trying to get DacFX to work properly.

            ServerConnection connection = new ServerConnection(ServerName);
            Server sqlServer = new Server(connection);
            Database QADatabase = sqlServer.Databases[DatabaseName];
            QADatabase.DatabaseOptions.UserAccess = DatabaseUserAccess.Single;
            QADatabase.Alter(TerminationClause.RollbackTransactionsImmediately);
            QADatabase.Refresh();

//DACPAC logic goes here

            QADatabase.DatabaseOptions.UserAccess = DatabaseUserAccess.Multiple;
            QADatabase.Alter(TerminationClause.RollbackTransactionsImmediately);
            QADatabase.Refresh();

这篇关于发布dacpac使用Microsoft.SqlServer.Dac.DacServices单用户模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆