Exemplo n.º 1
0
        private string ReplaceTemplatePlaceHolders(string templateContent, DatabaseObjectType databaseObjectType, ScriptAction scriptAction)
        {
            templateContent = templateContent.Replace("$ACTION$", scriptAction.ToString())
                              .Replace("$NAME$", this.dbInterpreter.GetQuotedString($"{databaseObjectType.ToString().ToUpper()}_NAME"))
                              .Replace("$TABLE_NAME$", this.dbInterpreter.GetQuotedString($"TABLE_NAME"));

            return(templateContent);
        }
Exemplo n.º 2
0
        public override string ToString()
        {
            string s = "[" + Operation.ToString() + "] ";

            if (ScriptAction != null)
            {
                s += ScriptAction.ToString();
            }
            else
            {
                s += "<NULL>";
            }
            return(s);
        }
Exemplo n.º 3
0
        private async Task <Result <Unit> > PerformAction(ScriptAction action)
        {
            Console.WriteLine($"Attempting to {action.ToString()}");
            switch (action.ActionType)
            {
            case ScriptActionType.Start:
                return(await _repository.RetryStartService(action.ServiceName, MaxAttempts, RetryInterval));

            case ScriptActionType.Stop:
                return(await _repository.RetryStopService(action.ServiceName, MaxAttempts, RetryInterval));

            case ScriptActionType.Reset:
                return(new Exception("Reset actions are not primitive.").AsError <Unit>());

            default:
                return(new Exception("Invalid enum value.").AsError <Unit>());
            }
        }