Ejemplo n.º 1
0
        void IInstallAction.Run(SetupVariables vars)
        {
            try
            {
                //
                Log.WriteStart(String.Format("Creating database user {0}", vars.Database));
                //
                vars.DatabaseUserPassword = Utils.GetRandomString(20);
                //user name should be the same as database
                vars.NewDatabaseUser = SqlUtils.CreateUser(vars.DbInstallConnectionString, vars.Database, vars.DatabaseUserPassword, vars.Database);
                //
                Log.WriteEnd("Created database user");
                InstallLog.AppendLine("- Created database user \"{0}\"", vars.Database);
            }
            catch (Exception ex)
            {
                if (Utils.IsThreadAbortException(ex))
                {
                    return;
                }

                Log.WriteError("Create db user error", ex);
                throw;
            }
        }