本文整理汇总了C#中Dev2.DataList.Contract.ErrorResultTO.MergeErrors方法的典型用法代码示例。如果您正苦于以下问题:C# ErrorResultTO.MergeErrors方法的具体用法?C# ErrorResultTO.MergeErrors怎么用?C# ErrorResultTO.MergeErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dev2.DataList.Contract.ErrorResultTO
的用法示例。
在下文中一共展示了ErrorResultTO.MergeErrors方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecutionImpl
protected override Guid ExecutionImpl(IEsbChannel esbChannel, IDSFDataObject dataObject, string inputs, string outputs, out ErrorResultTO errors, int update)
{
var execErrors = new ErrorResultTO();
errors = new ErrorResultTO();
errors.MergeErrors(execErrors);
var databaseServiceExecution = ServiceExecution as DatabaseServiceExecution;
if(databaseServiceExecution != null)
{
databaseServiceExecution.InstanceInputDefinitions = inputs; // set the output mapping for the instance ;)
databaseServiceExecution.InstanceOutputDefintions = outputs; // set the output mapping for the instance ;)
}
//ServiceExecution.DataObj = dataObject;
var result = ServiceExecution.Execute(out execErrors, update);
var fetchErrors = execErrors.FetchErrors();
foreach(var error in fetchErrors)
{
dataObject.Environment.Errors.Add(error);
}
errors.MergeErrors(execErrors);
// Adjust the remaining output mappings ;)
return result;
}
示例2: ExecutionImpl
protected override Guid ExecutionImpl(IEsbChannel esbChannel, IDSFDataObject dataObject, string inputs, string outputs, out ErrorResultTO tmpErrors, int update)
{
_errorsTo = new ErrorResultTO();
var pluginServiceExecution = GetNewPluginServiceExecution(dataObject);
pluginServiceExecution.InstanceInputDefinitions = inputs;
pluginServiceExecution.InstanceOutputDefintions = outputs;
tmpErrors = new ErrorResultTO();
tmpErrors.MergeErrors(_errorsTo);
var result = ExecutePluginService(pluginServiceExecution, update);
tmpErrors.MergeErrors(_errorsTo);
return result;
}
示例3: ExecutionImpl
protected override Guid ExecutionImpl(IEsbChannel esbChannel, IDSFDataObject dataObject, string inputs, string outputs, out ErrorResultTO tmpErrors)
{
_errorsTo = new ErrorResultTO();
var compiler = DataListFactory.CreateDataListCompiler();
ErrorResultTO invokeErrors;
esbChannel.CorrectDataList(dataObject, dataObject.WorkspaceID, out invokeErrors, compiler);
dataObject.DataListID = compiler.Shape(dataObject.DataListID, enDev2ArgumentType.Input, inputs, out invokeErrors);
_errorsTo.MergeErrors(invokeErrors);
_errorsTo.MergeErrors(invokeErrors);
var pluginServiceExecution = GetNewPluginServiceExecution(dataObject);
pluginServiceExecution.InstanceInputDefinitions = inputs;
pluginServiceExecution.InstanceOutputDefintions = outputs;
tmpErrors = new ErrorResultTO();
tmpErrors.MergeErrors(_errorsTo);
var result = ExecutePluginService(pluginServiceExecution);
tmpErrors.MergeErrors(_errorsTo);
return result;
}
示例4: Execute
public override Guid Execute(out ErrorResultTO errors, int update)
{
errors = new ErrorResultTO();
var invokeErrors = new ErrorResultTO();
Guid result = GlobalConstants.NullDataListID;
try
{
EsbManagementServiceLocator emsl = new EsbManagementServiceLocator();
IEsbManagementEndpoint eme = emsl.LocateManagementService(ServiceAction.Name);
if(eme != null)
{
// Web request for internal service ;)
if(Request.Args == null)
{
GenerateRequestDictionaryFromDataObject(out invokeErrors);
errors.MergeErrors(invokeErrors);
}
var res = eme.Execute(Request.Args, TheWorkspace);
Request.ExecuteResult = res;
errors.MergeErrors(invokeErrors);
result = DataObject.DataListID;
Request.WasInternalService = true;
}
else
{
errors.AddError("Could not locate management service [ " + ServiceAction.ServiceName + " ]");
}
}
catch(Exception ex)
{
errors.AddError(ex.Message);
}
return result;
}
示例5: Replace
/// <summary>
/// Replaces a value in and entry with a new value.
/// </summary>
/// <param name="stringToSearch">The old string.</param>
/// <param name="findString">The old string.</param>
/// <param name="replacementString">The new string.</param>
/// <param name="caseMatch">if set to <c>true</c> [case match].</param>
/// <param name="errors">The errors.</param>
/// <param name="replaceCount">The replace count.</param>
/// <returns></returns>
public string Replace(string stringToSearch, string findString, string replacementString, bool caseMatch, out ErrorResultTO errors, ref int replaceCount)
{
var oldString = stringToSearch;
ErrorResultTO allErrors = new ErrorResultTO();
errors = new ErrorResultTO();
allErrors.MergeErrors(errors);
var regexOptions = caseMatch ? NoneCompiled : IgnoreCaseCompiled;
Regex regex = new Regex(Regex.Escape(findString), regexOptions);
string tmpVal = oldString;
replaceCount += regex.Matches(tmpVal).Count;
var replaceValue = regex.Replace(tmpVal, replacementString);
errors = allErrors;
return replaceValue;
}
示例6: DispatchDebugState
public void DispatchDebugState(IDSFDataObject dataObject, StateType stateType, bool hasErrors, string existingErrors, out ErrorResultTO errors, DateTime? workflowStartTime = null, bool interrogateInputs = false, bool interrogateOutputs = false)
{
errors = new ErrorResultTO();
if(dataObject != null)
{
Guid parentInstanceId;
Guid.TryParse(dataObject.ParentInstanceID, out parentInstanceId);
IDataListCompiler compiler = DataListFactory.CreateDataListCompiler();
bool hasError = dataObject.Environment.HasErrors();
var errorMessage = String.Empty;
if(hasError)
{
errorMessage = dataObject.Environment.FetchErrors();
}
if(String.IsNullOrEmpty(existingErrors))
{
existingErrors = errorMessage;
}
else
{
existingErrors += Environment.NewLine + errorMessage;
}
var debugState = new DebugState
{
ID = dataObject.OriginalInstanceID,
ParentID = parentInstanceId,
WorkspaceID = dataObject.WorkspaceID,
StateType = stateType,
StartTime = workflowStartTime ?? DateTime.Now,
EndTime = DateTime.Now,
ActivityType = ActivityType.Workflow,
DisplayName = dataObject.ServiceName,
IsSimulation = dataObject.IsOnDemandSimulation,
ServerID = dataObject.ServerID,
OriginatingResourceID = dataObject.ResourceID,
OriginalInstanceID = dataObject.OriginalInstanceID,
Server = string.Empty,
Version = string.Empty,
SessionID = dataObject.DebugSessionID,
EnvironmentID = dataObject.EnvironmentID,
ClientID = dataObject.ClientID,
Name = stateType.ToString(),
HasError = hasErrors || hasError,
ErrorMessage = existingErrors
};
if(interrogateInputs)
{
ErrorResultTO invokeErrors;
var defs = compiler.GenerateDefsFromDataListForDebug(FindServiceShape(dataObject.WorkspaceID, dataObject.ResourceID), enDev2ColumnArgumentDirection.Input);
var inputs = GetDebugValues(defs, dataObject, out invokeErrors);
errors.MergeErrors(invokeErrors);
debugState.Inputs.AddRange(inputs);
}
if(interrogateOutputs)
{
ErrorResultTO invokeErrors;
var defs = compiler.GenerateDefsFromDataListForDebug(FindServiceShape(dataObject.WorkspaceID, dataObject.ResourceID), enDev2ColumnArgumentDirection.Output);
var inputs = GetDebugValues(defs, dataObject, out invokeErrors);
errors.MergeErrors(invokeErrors);
debugState.Outputs.AddRange(inputs);
}
if(stateType == StateType.End)
{
debugState.NumberOfSteps = dataObject.NumberOfSteps;
}
if(stateType == StateType.Start)
{
debugState.ExecutionOrigin = dataObject.ExecutionOrigin;
debugState.ExecutionOriginDescription = dataObject.ExecutionOriginDescription;
}
if(dataObject.IsDebugMode() || (dataObject.RunWorkflowAsync && !dataObject.IsFromWebServer))
{
var debugDispatcher = GetDebugDispatcher();
if(debugState.StateType == StateType.End)
{
while(!debugDispatcher.IsQueueEmpty)
{
Thread.Sleep(100);
}
debugDispatcher.Write(debugState, dataObject.RemoteInvoke, dataObject.RemoteInvokerID, dataObject.ParentInstanceID, dataObject.RemoteDebugItems);
}
else
{
debugDispatcher.Write(debugState);
}
}
}
}
示例7: ConvertTo
public IBinaryDataList ConvertTo(byte[] input, StringBuilder targetShape, out ErrorResultTO errors)
{
errors = new ErrorResultTO();
var payload = Encoding.UTF8.GetString(input);
IBinaryDataList result = null;
// build shape
if(targetShape == null)
{
errors.AddError("Null payload or shape");
}
else
{
ErrorResultTO invokeErrors;
result = _tu.TranslateShapeToObject(targetShape, false, out invokeErrors);
errors.MergeErrors(invokeErrors);
// populate the shape
if(payload != string.Empty)
{
try
{
string toLoad = DataListUtil.StripCrap(payload); // clean up the rubbish ;)
XmlDocument xDoc = new XmlDocument();
try
{
xDoc.LoadXml(toLoad);
}
catch
{
// Append new root tags ;)
toLoad = "<root>" + toLoad + "</root>";
xDoc.LoadXml(toLoad);
}
if(!string.IsNullOrEmpty(toLoad))
{
if(xDoc.DocumentElement != null)
{
XmlNodeList children = xDoc.DocumentElement.ChildNodes;
IDictionary<string, int> indexCache = new Dictionary<string, int>();
IBinaryDataListEntry entry;
string error;
if(children.Count > 0 && !DataListUtil.IsMsXmlBugNode(children[0].Name))
{
#region Process children
// spin through each element in the XML
foreach(XmlNode c in children)
{
var hasCorrectIoDirection = true;
if(c.Attributes != null)
{
var columnIoDirectionAttribute = c.Attributes["ColumnIODirection"];
if(columnIoDirectionAttribute != null)
{
var columnIoDirectionValue = columnIoDirectionAttribute.Value;
var hasCorrectIoDirectionFromAttribute = columnIoDirectionValue == enDev2ColumnArgumentDirection.Output.ToString() || columnIoDirectionValue == enDev2ColumnArgumentDirection.Both.ToString();
hasCorrectIoDirection = hasCorrectIoDirectionFromAttribute;
}
}
if(DataListUtil.IsSystemTag(c.Name) && !hasCorrectIoDirection)
{
continue;
}
// scalars and recordset fetch
if(result.TryGetEntry(c.Name, out entry, out error))
{
if(entry.IsRecordset)
{
// fetch recordset index
int fetchIdx;
int idx = indexCache.TryGetValue(c.Name, out fetchIdx) ? fetchIdx : 1;
// process recordset
XmlNodeList nl = c.ChildNodes;
foreach(XmlNode subc in nl)
{
entry.TryPutRecordItemAtIndex(Dev2BinaryDataListFactory.CreateBinaryItem(subc.InnerXml, c.Name, subc.Name, (idx + "")), idx, out error);
if(!string.IsNullOrEmpty(error))
{
errors.AddError(error);
}
}
// update this recordset index
indexCache[c.Name] = ++idx;
}
else
{
entry.TryPutScalar(Dev2BinaryDataListFactory.CreateBinaryItem(c.InnerXml, c.Name), out error);
if(!string.IsNullOrEmpty(error))
{
errors.AddError(error);
}
}
//.........这里部分代码省略.........
示例8: CreateForm
//.........这里部分代码省略.........
{
resource = ResourceCatalog.Instance.GetResource(dataObject.WorkspaceID, dataObject.ServiceName);
if(resource != null)
{
dataObject.ResourceID = resource.ResourceID;
}
}
var esbEndpoint = new EsbServicesEndpoint();
dataObject.EsbChannel = esbEndpoint;
var canExecute = true;
if(ServerAuthorizationService.Instance != null)
{
var authorizationService = ServerAuthorizationService.Instance;
var hasView = authorizationService.IsAuthorized(AuthorizationContext.View, dataObject.ResourceID.ToString());
var hasExecute = authorizationService.IsAuthorized(AuthorizationContext.Execute, dataObject.ResourceID.ToString());
canExecute = (hasExecute && hasView) || ((dataObject.RemoteInvoke || dataObject.RemoteNonDebugInvoke) && hasExecute) || (resource != null && resource.ResourceType == ResourceType.ReservedService);
}
// Build EsbExecutionRequest - Internal Services Require This ;)
EsbExecuteRequest esbExecuteRequest = new EsbExecuteRequest { ServiceName = serviceName };
foreach(string key in webRequest.Variables)
{
esbExecuteRequest.AddArgument(key, new StringBuilder(webRequest.Variables[key]));
}
Dev2Logger.Log.Debug("About to execute web request [ " + serviceName + " ] DataObject Payload [ " + dataObject.RawPayload + " ]");
var executionDlid = GlobalConstants.NullDataListID;
if (canExecute && dataObject.ReturnType != EmitionTypes.SWAGGER)
{
ErrorResultTO errors = null;
// set correct principle ;)
Thread.CurrentPrincipal = user;
var userPrinciple = user;
Common.Utilities.PerformActionInsideImpersonatedContext(userPrinciple, () => { executionDlid = esbEndpoint.ExecuteRequest(dataObject, esbExecuteRequest, workspaceGuid, out errors); });
allErrors.MergeErrors(errors);
}
else if(!canExecute)
{
allErrors.AddError("Executing a service externally requires View and Execute permissions");
}
foreach(var error in dataObject.Environment.Errors)
{
allErrors.AddError(error,true);
}
// Fetch return type ;)
var formatter = DataListFormat.CreateFormat("XML", EmitionTypes.XML, "text/xml");
// force it to XML if need be ;)
// Fetch and convert DL ;)
if(!dataObject.Environment.HasErrors())
{
// a normal service request
if(!esbExecuteRequest.WasInternalService)
{
dataObject.DataListID = executionDlid;
dataObject.WorkspaceID = workspaceGuid;
dataObject.ServiceName = serviceName;
if(!dataObject.IsDebug || dataObject.RemoteInvoke || dataObject.RemoteNonDebugInvoke)
{
if (dataObject.ReturnType == EmitionTypes.JSON)
{
formatter = DataListFormat.CreateFormat("JSON", EmitionTypes.JSON, "application/json");
executePayload = ExecutionEnvironmentUtils.GetJsonOutputFromEnvironment(dataObject, resource.DataList.ToString(),0);
}
else if (dataObject.ReturnType == EmitionTypes.XML)
示例9: GenerateUserFriendlyModel
public string GenerateUserFriendlyModel(IExecutionEnvironment env, Dev2DecisionMode mode, out ErrorResultTO errors)
{
errors = new ErrorResultTO();
ErrorResultTO allErrors = new ErrorResultTO();
string fn = DecisionDisplayHelper.GetDisplayValue(EvaluationFn);
if(PopulatedColumnCount == 0)
{
return "If " + fn + " ";
}
if(PopulatedColumnCount == 1)
{
if(DataListUtil.GetRecordsetIndexType(Col1) == enRecordsetIndexType.Star)
{
var allValues = DataListUtil.GetAllPossibleExpressionsForFunctionOperations(Col1, env, out errors);
allErrors.MergeErrors(errors);
StringBuilder expandStarredIndex = new StringBuilder();
expandStarredIndex.Append(allValues[0] + " " + fn);
allValues.RemoveAt(0);
foreach(var value in allValues)
{
expandStarredIndex.Append(" " + mode + " " + value + " " + fn);
}
errors = allErrors;
return "If " + expandStarredIndex;
}
errors = allErrors;
return "If " + Col1 + " " + fn + " ";
}
if(PopulatedColumnCount == 2)
{
StringBuilder expandStarredIndices = new StringBuilder();
if(DataListUtil.GetRecordsetIndexType(Col1) != enRecordsetIndexType.Star && DataListUtil.GetRecordsetIndexType(Col2) == enRecordsetIndexType.Star)
{
var allCol2Values = DataListUtil.GetAllPossibleExpressionsForFunctionOperations(Col2, env, out errors);
allErrors.MergeErrors(errors);
expandStarredIndices.Append(Col1 + " " + fn + " " + allCol2Values[0]);
allCol2Values.RemoveAt(0);
foreach(var value in allCol2Values)
{
expandStarredIndices.Append(" " + mode + " " + Col1 + " " + fn + " " + value);
}
errors = allErrors;
return "If " + expandStarredIndices;
}
if(DataListUtil.GetRecordsetIndexType(Col1) == enRecordsetIndexType.Star && DataListUtil.GetRecordsetIndexType(Col2) != enRecordsetIndexType.Star)
{
var allCol1Values = DataListUtil.GetAllPossibleExpressionsForFunctionOperations(Col1, env, out errors);
allErrors.MergeErrors(errors);
expandStarredIndices.Append(allCol1Values[0] + " " + fn + " " + Col2);
allCol1Values.RemoveAt(0);
foreach(var value in allCol1Values)
{
expandStarredIndices.Append(" " + mode + " " + value + " " + fn + " " + Col2);
}
errors = allErrors;
return "If " + expandStarredIndices;
}
if((DataListUtil.GetRecordsetIndexType(Col1) == enRecordsetIndexType.Star && DataListUtil.GetRecordsetIndexType(Col2) == enRecordsetIndexType.Star) || (DataListUtil.GetRecordsetIndexType(Col1) != enRecordsetIndexType.Star && DataListUtil.GetRecordsetIndexType(Col2) != enRecordsetIndexType.Star))
{
var allCol1Values = DataListUtil.GetAllPossibleExpressionsForFunctionOperations(Col1, env, out errors);
allErrors.MergeErrors(errors);
var allCol2Values = DataListUtil.GetAllPossibleExpressionsForFunctionOperations(Col2, env, out errors);
allErrors.MergeErrors(errors);
expandStarredIndices.Append(allCol1Values[0] + " " + fn + " " + allCol2Values[0]);
allCol1Values.RemoveAt(0);
allCol2Values.RemoveAt(0);
for(var i = 0; i < Math.Max(allCol1Values.Count, allCol2Values.Count); i++)
{
if(i > allCol1Values.Count)
{
allCol1Values.Add(null);
}
if(i > allCol2Values.Count)
{
allCol2Values.Add(null);
}
try
{
expandStarredIndices.Append(" " + mode + " " + allCol1Values[i] + " " + fn + " " +
allCol2Values[i]);
}
catch(IndexOutOfRangeException)
{
errors.AddError("You appear to have recordsets of differnt sizes");
allErrors.MergeErrors(errors);
}
}
errors = allErrors;
return "If " + expandStarredIndices;
}
errors = allErrors;
return "If " + Col1 + " " + fn + " " + Col2 + " ";
}
//.........这里部分代码省略.........
示例10: Populate
public Guid Populate(object input, Guid targetDl, string outputDefs, out ErrorResultTO errors)
{
errors = new ErrorResultTO();
var compiler = DataListFactory.CreateDataListCompiler();
ErrorResultTO invokeErrors;
IBinaryDataList targetDL = compiler.FetchBinaryDataList(targetDl, out invokeErrors);
errors.MergeErrors(invokeErrors);
DataTable dbData = (input as DataTable);
if(dbData != null && outputDefs != null)
{
var defs = DataListFactory.CreateOutputParser().Parse(outputDefs);
HashSet<string> processedRecNames = new HashSet<string>();
foreach(var def in defs)
{
var expression = def.Value;
var rsName = DataListUtil.ExtractRecordsetNameFromValue(expression);
var rsType = DataListUtil.GetRecordsetIndexType(expression);
var rowIndex = DataListUtil.ExtractIndexRegionFromRecordset(expression);
var rsNameUse = def.RecordSetName;
if(string.IsNullOrEmpty(rsName))
{
rsName = rsNameUse;
}
if(string.IsNullOrEmpty(rsName))
{
rsName = def.Name;
}
if(processedRecNames.Contains(rsName))
{
continue;
}
processedRecNames.Add(rsName);
// build up the columns ;)
string error;
IBinaryDataListEntry entry;
if(targetDL.TryGetEntry(rsName, out entry, out error))
{
if(entry.IsRecordset)
{
var cols = entry.Columns;
IDictionary<int, string> colMapping = BuildColumnNameToIndexMap(entry.Columns,
dbData.Columns,
defs);
// now convert to binary datalist ;)
int rowIdx = entry.FetchAppendRecordsetIndex();
if(rsType == enRecordsetIndexType.Star)
{
rowIdx = 1;
}
if(rsType == enRecordsetIndexType.Numeric)
{
rowIdx = int.Parse(rowIndex);
}
if(dbData.Rows != null)
{
foreach(DataRow row in dbData.Rows)
{
IList<IBinaryDataListItem> items = new List<IBinaryDataListItem>(cols.Count);
// build up the row
int idx = 0;
foreach(var item in row.ItemArray)
{
string colName;
if(colMapping.TryGetValue(idx, out colName))
{
items.Add(new BinaryDataListItem(item.ToString(), rsNameUse, colName, rowIdx));
}
idx++;
}
// add the row ;)
entry.TryPutRecordRowAt(items, rowIdx, out error);
errors.AddError(error);
rowIdx++;
}
}
}
else
{
// handle a scalar coming out ;)
if(dbData.Rows != null && dbData.Rows.Count == 1)
{
var row = dbData.Rows[0].ItemArray;
// Look up the correct index from the columns ;)
//.........这里部分代码省略.........
示例11: GenerateRequestDictionaryFromDataObject
private void GenerateRequestDictionaryFromDataObject(out ErrorResultTO errors)
{
var compiler = DataListFactory.CreateDataListCompiler();
errors = new ErrorResultTO();
ErrorResultTO invokeErrors;
IBinaryDataList bdl = compiler.FetchBinaryDataList(DataObject.DataListID, out invokeErrors);
errors.MergeErrors(invokeErrors);
if(!invokeErrors.HasErrors())
{
foreach(IBinaryDataListEntry entry in bdl.FetchScalarEntries())
{
IBinaryDataListItem itm = entry.FetchScalar();
if(!DataListUtil.IsSystemTag(itm.FieldName))
{
var stringBuilder = new StringBuilder("");
try
{
stringBuilder = new StringBuilder(itm.TheValue);
}
// ReSharper disable EmptyGeneralCatchClause
catch(Exception)
// ReSharper restore EmptyGeneralCatchClause
{
}
Request.AddArgument(itm.FieldName, stringBuilder);
}
}
}
}
示例12: Populate
// NOTE : This will be tested by the related WebServices and Plugin Integration Test
public Guid Populate(object input, Guid targetDl, string outputDefs, out ErrorResultTO errors)
{
// input is a string of output mappings ;)
var compiler = DataListFactory.CreateDataListCompiler();
var outputDefinitions = (input as string);
errors = new ErrorResultTO();
ErrorResultTO invokeErrors;
// get sneeky and use the output shape operation for now,
// as this should only every be called from external service containers all is good
// if this is ever not the case be afraid, be very afraid!
var targetDataList = compiler.FetchBinaryDataList(targetDl, out invokeErrors);
errors.MergeErrors(invokeErrors);
var parentDataList = compiler.FetchBinaryDataList(targetDataList.ParentUID, out invokeErrors);
errors.MergeErrors(invokeErrors);
var grandparentDl = compiler.FetchBinaryDataList(parentDataList.ParentUID, out invokeErrors);
// as a result we need to re-set some alias operations that took place in the parent DataList where they happended ;)
foreach(var entry in parentDataList.FetchRecordsetEntries())
{
entry.AdjustAliasOperationForExternalServicePopulate();
}
var parentId = parentDataList.UID;
if(grandparentDl != null)
{
parentId = grandparentDl.UID;
}
compiler.SetParentID(targetDl, parentId);
Guid result = compiler.Shape(targetDl, enDev2ArgumentType.Output, outputDefinitions, out invokeErrors);
errors.MergeErrors(invokeErrors);
return result;
}
示例13: CreateDataListEvaluateIterator
IDev2DataListEvaluateIterator CreateDataListEvaluateIterator(string expression, Guid executionId, IDataListCompiler compiler, IDev2IteratorCollection iteratorCollection, ErrorResultTO allErrors)
{
ErrorResultTO errors;
IBinaryDataListEntry expressionEntry = compiler.Evaluate(executionId, enActionType.User, expression, false, out errors);
allErrors.MergeErrors(errors);
IDev2DataListEvaluateIterator expressionIterator = Dev2ValueObjectFactory.CreateEvaluateIterator(expressionEntry);
iteratorCollection.AddIterator(expressionIterator);
return expressionIterator;
}
示例14: SqlDatabaseCommand
//.........这里部分代码省略.........
// IBinaryDataListEntry be = Dev2BinaryDataListFactory.CreateEntry(enSystemTag.Error.ToString(),
// string.Empty);
// string error;
// be.TryPutScalar(
// Dev2BinaryDataListFactory.CreateBinaryItem(allErrors.MakeDataListReady(),
// enSystemTag.Error.ToString()), out error);
// if(error != string.Empty)
// {
// errors.AddError(error);
// }
// SvrCompiler.Upsert(null, req.DataListID,
// DataListUtil.BuildSystemTagForDataList(enSystemTag.Error, true), be, out errors);
// // now merge and delete tmp
// if(tmpID != GlobalConstants.NullDataListID)
// {
// ClientCompiler.Shape(tmpID, enDev2ArgumentType.Output, serviceAction.ServiceActionOutputs,
// out errors);
// ClientCompiler.DeleteDataListByID(tmpID);
// result = req.DataListID;
// }
// //ExceptionHandling.WriteEventLogEntry("Application", string.Format("{0}.{1}", this.GetType().Name, "SqlDatabaseCommand"), string.Format("Exception:{0}\r\nInputData:{1}", xmlResponse.XmlString, xmlRequest.XmlString), EventLogEntryType.Error);
// }
// return result;
// }
//}
public dynamic SqlDatabaseCommand(ServiceAction serviceAction, IDSFDataObject req)
{
Guid result = GlobalConstants.NullDataListID;
Guid tmpID = GlobalConstants.NullDataListID;
var errors = new ErrorResultTO();
var allErrors = new ErrorResultTO();
try
{
// Get XAML data from service action
string xmlDbResponse = GetXmlDataFromSqlServiceAction(serviceAction);
if (string.IsNullOrEmpty(xmlDbResponse))
{
// If there was no data returned add error
allErrors.AddError("The request yielded no response from the data store.");
}
else
{
// Get the output formatter from the service action
IOutputFormatter outputFormatter = GetOutputFormatterFromServiceAction(serviceAction);
if (outputFormatter == null)
{
// If there was an error getting the output formatter from the service action
allErrors.AddError(string.Format("Output format in service action {0} is invalid.", serviceAction.Name));
}
else
{
// Format the XML data
string formatedPayload = outputFormatter.Format(xmlDbResponse).ToString();
// Create a shape from the service action outputs
string dlShape = ClientCompiler.ShapeDev2DefinitionsToDataList(serviceAction.ServiceActionOutputs, enDev2ArgumentType.Output, false, out errors);
allErrors.MergeErrors(errors);
// Push formatted data into a datalist using the shape from the service action outputs
tmpID = ClientCompiler.ConvertTo(DataListFormat.CreateFormat(GlobalConstants._XML), formatedPayload, dlShape, out errors);
allErrors.MergeErrors(errors);
// Attach a parent ID to the newly created datalist
var parentID = ClientCompiler.FetchParentID(req.DataListID);
ClientCompiler.SetParentID(tmpID, parentID);
}
}
}
catch (Exception ex)
{
allErrors.AddError(ex.Message);
}
finally
{
// If a datalist was ceated
if (tmpID != GlobalConstants.NullDataListID)
{
// Merge into it's parent
ClientCompiler.Shape(tmpID, enDev2ArgumentType.Output, serviceAction.ServiceActionOutputs, out errors);
allErrors.MergeErrors(errors);
// Delete data list
ClientCompiler.DeleteDataListByID(tmpID);
result = req.DataListID;
}
// Add any errors that occured to the datalist
AddErrorsToDataList(allErrors, req.DataListID);
}
return result;
}
示例15: ManagementDynamicService
/// <summary>
/// Invoke a management method which is a statically coded method in the service implementation for service engine administrators
/// </summary>
/// <param name="serviceAction">Action of type InvokeManagementDynamicService</param>
/// <param name="xmlRequest">The XML request.</param>
/// <returns>
/// UnlimitedObject
/// </returns>
public Guid ManagementDynamicService(ServiceAction serviceAction, IDSFDataObject xmlRequest)
{
var errors = new ErrorResultTO();
var allErrors = new ErrorResultTO();
Guid result = GlobalConstants.NullDataListID;
try
{
object[] parameterValues = null;
//Instantiate a Endpoint object that contains all static management methods
object o = this;
//Activator.CreateInstance(typeof(Unlimited.Framework.DynamicServices.DynamicServicesEndpoint), new object[] {string.Empty});
//Get the management method
MethodInfo m = o.GetType().GetMethod(serviceAction.SourceMethod);
//Infer the parameters of the management method
ParameterInfo[] parameters = m.GetParameters();
//If there are parameters then retrieve them from the service action input values
if(parameters.Count() > 0)
{
IEnumerable<object> parameterData = from c in serviceAction.ServiceActionInputs
select c.Value;
parameterValues = parameterData.ToArray();
}
//Invoke the management method and store the return value
string val = m.Invoke(o, parameterValues).ToString();
result = ClientCompiler.UpsertSystemTag(xmlRequest.DataListID, enSystemTag.ManagmentServicePayload, val,
out errors);
//_clientCompiler.Upsert(xmlRequest.DataListID, DataListUtil.BuildSystemTagForDataList(enSystemTag.ManagmentServicePayload, true), val, out errors);
allErrors.MergeErrors(errors);
//returnval = new UnlimitedObject(GetXElement(val));
}
catch(Exception ex)
{
allErrors.AddError(ex.Message);
}
finally
{
// handle any errors that might have occured
if(allErrors.HasErrors())
{
IBinaryDataListEntry be = Dev2BinaryDataListFactory.CreateEntry(enSystemTag.Error.ToString(),
string.Empty);
string error;
be.TryPutScalar(
Dev2BinaryDataListFactory.CreateBinaryItem(allErrors.MakeDataListReady(),
enSystemTag.Error.ToString()), out error);
if(error != string.Empty)
{
errors.AddError(error);
}
}
// No cleanup to happen ;)
}
return result;
}