/// <summary>
 /// Determines whether the item is installed.
 /// </summary>
 /// <param name="installationContext">The installation context.</param>
 /// <returns>
 /// Value indicating whether the item is installed or null if it is not possible to determine.
 /// </returns>
 public bool? IsInstalled(InstallationContext installationContext)
 {
     return null;
 }
        private void RunInstallCommands(InstallationContext installationContext, IEnumerable<DatabaseCommandInfo> commands)
        {
            // create log event that will be used to render all layouts
            LogEventInfo logEvent = installationContext.CreateLogEvent();

            try
            {
                foreach (var commandInfo in commands)
                {
                    string cs;

                    if (commandInfo.ConnectionString != null)
                    {
                        // if there is connection string specified on the command info, use it
                        cs = commandInfo.ConnectionString.Render(logEvent);
                    }
                    else if (this.InstallConnectionString != null)
                    {
                        // next, try InstallConnectionString
                        cs = this.InstallConnectionString.Render(logEvent);
                    }
                    else
                    {
                        // if it's not defined, fall back to regular connection string
                        cs = this.BuildConnectionString(logEvent);
                    }

                    this.EnsureConnectionOpen(cs);

                    var command = this.activeConnection.CreateCommand();
                    command.CommandType = commandInfo.CommandType;
                    command.CommandText = commandInfo.Text.Render(logEvent);

                    try
                    {
                        installationContext.Trace("Executing {0} '{1}'", command.CommandType, command.CommandText);
                        command.ExecuteNonQuery();
                    }
                    catch (Exception exception)
                    {
                        if (exception.MustBeRethrown())
                        {
                            throw;
                        }

                        if (commandInfo.IgnoreFailures || installationContext.IgnoreFailures)
                        {
                            installationContext.Warning(exception.Message);
                        }
                        else
                        {
                            installationContext.Error(exception.Message);
                            throw;
                        }
                    }
                }
            }
            finally 
            {
                this.CloseConnection();
            }
        }
 /// <summary>
 /// Performs uninstallation which requires administrative permissions.
 /// </summary>
 /// <param name="installationContext">The installation context.</param>
 public void Uninstall(InstallationContext installationContext)
 {
     this.RunInstallCommands(installationContext, this.UninstallDdlCommands);
 }