private void ExecuteScripts(IEnumerable <string> scripts, bool throwExceptions) { if (scripts == null) { return; } var sqlExecutor = new SQLExecutor(BootstrapServices); IList <string> errors = new List <string>(); foreach (var sql in scripts) { try { if (ExecuteScriptsWithoutTransaction) { sqlExecutor.ExecuteNonQueryWithoutTransaction(sql); } else { sqlExecutor.ExecuteNonQuery(sql); } } catch (Exception e) { errors.Add(e.Message); } } if (throwExceptions && errors.Count > 0) { throw new Exception( string.Format("Error executing scripts for provider '{0}' with connection string '{1}':{2}{3}", BootstrapServices.DatabaseConfiguration.DatabaseProvider.Properties.DisplayName, BootstrapServices.DatabaseConfiguration.ConnectionString, Environment.NewLine, string.Join(Environment.NewLine, errors.ToArray()))); } }