public void SaveScheme(string schemaCode, bool canBeInlined, List <string> inlinedSchemes, string scheme) { using (MySqlConnection connection = new MySqlConnection(ConnectionString)) { WorkflowScheme wfScheme = WorkflowScheme.SelectByKey(connection, schemaCode); if (wfScheme == null) { wfScheme = new WorkflowScheme { Code = schemaCode, Scheme = scheme, CanBeInlined = canBeInlined, InlinedSchemes = inlinedSchemes.Any() ? JsonConvert.SerializeObject(inlinedSchemes) : null }; wfScheme.Insert(connection); } else { wfScheme.Scheme = scheme; wfScheme.CanBeInlined = canBeInlined; wfScheme.InlinedSchemes = inlinedSchemes.Any() ? JsonConvert.SerializeObject(inlinedSchemes) : null; wfScheme.Update(connection); } } }
public XElement GetScheme(string code) { using(MySqlConnection connection = new MySqlConnection(ConnectionString)) { WorkflowScheme scheme = WorkflowScheme.SelectByKey(connection, code); if (scheme == null || string.IsNullOrEmpty(scheme.Scheme)) throw new SchemeNotFoundException(); return XElement.Parse(scheme.Scheme); } }
public XElement GetScheme(string code) { using (MySqlConnection connection = new MySqlConnection(ConnectionString)) { var scheme = WorkflowScheme.SelectByKey(connection, code); if (scheme == null || string.IsNullOrEmpty(scheme.Scheme)) { throw SchemeNotFoundException.Create(code, SchemeLocation.WorkflowScheme); } return(XElement.Parse(scheme.Scheme)); } }
public void SaveScheme(string schemaCode, string scheme) { using (MySqlConnection connection = new MySqlConnection(ConnectionString)) { WorkflowScheme wfScheme = WorkflowScheme.SelectByKey(connection, schemaCode); if (wfScheme == null) { wfScheme = new WorkflowScheme(); wfScheme.Code = schemaCode; wfScheme.Scheme = scheme; wfScheme.Insert(connection); } else { wfScheme.Scheme = scheme; wfScheme.Update(connection); } } }