private IEnumerable <ParameterDefinitionWithValue> GetPersistedProcessParameters(Guid processId, ProcessDefinition processDefinition) { var persistenceParameters = processDefinition.PersistenceParameters.ToList(); var parameters = new List <ParameterDefinitionWithValue>(persistenceParameters.Count()); List <WorkflowProcessInstancePersistence> persistedParameters; using (SqlConnection connection = new SqlConnection(ConnectionString)) { persistedParameters = WorkflowProcessInstancePersistence.SelectByProcessId(connection, processId).ToList(); } foreach (var persistedParameter in persistedParameters) { var parameterDefinition = persistenceParameters.FirstOrDefault(p => p.Name == persistedParameter.ParameterName); if (parameterDefinition == null) { parameterDefinition = ParameterDefinition.Create(persistedParameter.ParameterName, "System.String", ParameterPurpose.Persistence.ToString(), null); } parameters.Add(ParameterDefinition.Create(parameterDefinition, _runtime.DeserializeParameter(persistedParameter.Value, parameterDefinition.Type))); } return(parameters); }
private IEnumerable <ParameterDefinitionWithValue> GetPersistedProcessParameters(Guid processId, ProcessDefinition processDefinition) { var persistenceParameters = processDefinition.PersistenceParameters.ToList(); var parameters = new List <ParameterDefinitionWithValue>(persistenceParameters.Count()); List <WorkflowProcessInstancePersistence> persistedParameters; using (OracleConnection connection = new OracleConnection(ConnectionString)) { persistedParameters = WorkflowProcessInstancePersistence.SelectByProcessId(connection, processId) .Where(WorkflowProcessInstancep => persistenceParameters.Select(pp => pp.Name).Contains(WorkflowProcessInstancep.ParameterName)).ToList(); } foreach (var persistedParameter in persistedParameters) { var parameterDefinition = persistenceParameters.Single(p => p.Name == persistedParameter.ParameterName); parameters.Add(ParameterDefinition.Create(parameterDefinition, _runtime.DeserializeParameter(persistedParameter.Value, parameterDefinition.Type))); } return(parameters); }