public void DeleteGlobalParameters(string type, string name = null) { using (MySqlConnection connection = new MySqlConnection(ConnectionString)) { WorkflowGlobalParameter.DeleteByTypeAndName(connection, type, name); } }
public void SaveGlobalParameter <T>(string type, string name, T value) { using (var connection = new MySqlConnection(ConnectionString)) { var parameter = WorkflowGlobalParameter.SelectByTypeAndName(connection, type, name).FirstOrDefault(); if (parameter == null) { parameter = new WorkflowGlobalParameter { Id = Guid.NewGuid(), Type = type, Name = name, Value = JsonConvert.SerializeObject(value) }; parameter.Insert(connection); } else { parameter.Value = JsonConvert.SerializeObject(value); parameter.Update(connection); } } }
public List <T> LoadGlobalParameters <T>(string type) { using (MySqlConnection connection = new MySqlConnection(ConnectionString)) { var parameters = WorkflowGlobalParameter.SelectByTypeAndName(connection, type); return(parameters.Select(p => JsonSerializer.DeserializeFromString <T>(p.Value)).ToList()); } }
public T LoadGlobalParameter<T>(string type, string name) { using (MySqlConnection connection = new MySqlConnection(ConnectionString)) { var parameter = WorkflowGlobalParameter.SelectByTypeAndName(connection, type, name).FirstOrDefault(); if (parameter == null) return default (T); return JsonSerializer.DeserializeFromString<T>(parameter.Value); } }
public T LoadGlobalParameter <T>(string type, string name) { using (MySqlConnection connection = new MySqlConnection(ConnectionString)) { var parameter = WorkflowGlobalParameter.SelectByTypeAndName(connection, type, name).FirstOrDefault(); if (parameter == null) { return(default(T)); } return(JsonConvert.DeserializeObject <T>(parameter.Value)); } }