gpt4 book ai didi

c# - TransactedInstaller 与嵌套安装程序

转载 作者:行者123 更新时间:2023-11-30 15:12:46 25 4
gpt4 key购买 nike

这个(嵌套Installer)有区别吗

ServiceInstaller si = new ServiceInstaller();
si.ServiceName = "MyService";

ServiceProcessInstaller spi = new ServiceProcessInstaller();
spi.Account = ServiceAccount.LocalSystem;

spi.Installers.Add(si);

this.Installers.Add(spi);

还有这个? (事务安装程序)

TransactedInstaller ti = new TransactedInstaller();

ServiceInstaller si = new ServiceInstaller();
si.ServiceName = "MyService";
ti.Installers.Add(si);

ServiceProcessInstaller spi = new ServiceProcessInstaller();
spi.Account = ServiceAccount.LocalSystem;
ti.Installers.Add(spi);

this.Installers.Add(ti);

默认情况下嵌套的安装程序是否被处理?应该首选哪种样式?

最佳答案

如果自定义操作成功/失败,

TransactedInstaller 将自动调用 Commit/Rollback。

使用嵌套安装程序,您需要在出现错误的情况下对回滚/提交进行排序,如果您没有明确告知,它们将不会被调用他们跑。

关于c# - TransactedInstaller 与嵌套安装程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/692986/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com