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); }
public override string ToString() { string s = "[" + Operation.ToString() + "] "; if (ScriptAction != null) { s += ScriptAction.ToString(); } else { s += "<NULL>"; } return(s); }
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>()); } }