TransactedInstaller vs Nested Installer

Is there any difference between this (nested installer)

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

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

spi.Installers.Add(si);

this.Installers.Add(spi);  

and this? (TransactedInstaller)

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);   

Is the default built-in installer nested? Which style should you choose?

+3
source share
1 answer

TransactedInstaller will automatically call Commit / Rollback if the user action succeeded / failed.

With the embedded installer, you will need to execute the "Rollback / commit yourself" command in case of an error, they will not be called unless you explicitly told them to start them.

+5
source

Source: https://habr.com/ru/post/1705505/


All Articles