次の方法で共有


SqlScriptListInstaller

The last of a series of SQL Server-related database Installers is a little helper that simply makes it easier to bundle several SQL scripts together as part of a single Installer package. Instead of mixing several SqlScriptInstallers together with other Installers, you can group them together in a single container:

 public class SqlScriptListInstaller : Installer
 {
     public SqlScriptListInstaller(
         IEnumerable<SqlScriptInstaller> scriptInstallers)
     {
         foreach (SqlScriptInstaller scriptInstaller
             in scriptInstallers)
         {
             this.Installers.Add(scriptInstaller);
         }
     }
 }

This Installer simply holds a list of SqlScriptInstallers in its Installers property. When Install is called, the Install method will be invoked on each of the contained Installers; likewise for Uninstall.

This is in no way the most essential of the three SQL Server-related Installers, but is still a nice convenience at times.

Comments