protected void ExecuteService(int update, out ErrorResultTO errors, IWcfAction method, IDSFDataObject dataObject, IOutputFormatter formater)
        {
            errors = new ErrorResultTO();
            Source = ResourceCatalog.GetResource <WcfSource>(dataObject.WorkspaceID, SourceId);
            var itrs = new List <IWarewolfIterator>(5);
            IWarewolfListIterator itrCollection = new WarewolfListIterator();
            var methodParameters = Inputs.Select(a => new MethodParameter {
                EmptyToNull = a.EmptyIsNull, IsRequired = a.RequiredField, Name = a.Name, Value = a.Value, TypeName = a.TypeName
            }).ToList();

            BuildParameterIterators(update, methodParameters.ToList(), itrCollection, itrs, dataObject);
            try
            {
                while (itrCollection.HasMoreData())
                {
                    var pos = 0;
                    foreach (var itr in itrs)
                    {
                        var injectVal = itrCollection.FetchNextValue(itr);
                        var param     = methodParameters.ToList()[pos];


                        param.Value = param.EmptyToNull &&
                                      (injectVal == null ||
                                       string.Compare(injectVal, string.Empty,
                                                      StringComparison.InvariantCultureIgnoreCase) == 0)
                            ? null
                            : injectVal;

                        pos++;
                    }

                    var result = Source.ExecuteMethod(method);

                    if (result != null)
                    {
                        ResponseManager = new ResponseManager {
                            OutputDescription = OutputDescription, Outputs = Outputs, IsObject = IsObject, ObjectName = ObjectName
                        };
                        ResponseManager.PushResponseIntoEnvironment(result.ToString(), update, dataObject);
                    }
                }
            }
            catch (Exception e)
            {
                errors.AddError(e.Message);
            }
        }
Beispiel #2
0
        public virtual RecordsetList FetchRecordset(WcfService wcfService)
        {
            if (wcfService == null)
            {
                throw new ArgumentNullException(nameof(wcfService));
            }
            var broker            = new WcfSource();
            var outputDescription = broker.ExecuteMethod(wcfService);
            var dataSourceShape   = outputDescription.DataSourceShapes[0];
            var recSet            = outputDescription.ToRecordsetList(wcfService.Recordsets, GlobalConstants.PrimitiveReturnValueTag);

            if (recSet != null)
            {
                foreach (var recordset in recSet)
                {
                    foreach (var field in recordset.Fields)
                    {
                        if (string.IsNullOrEmpty(field.Name))
                        {
                            continue;
                        }
                        var path    = field.Path;
                        var rsAlias = string.IsNullOrEmpty(field.RecordsetAlias) ? "" : field.RecordsetAlias.Replace("()", "");

                        var value = string.Empty;
                        if (!string.IsNullOrEmpty(field.Alias))
                        {
                            value = string.IsNullOrEmpty(rsAlias)
                                        ? $"[[{field.Alias}]]"
                                : $"[[{rsAlias}().{field.Alias}]]";
                        }

                        if (path != null)
                        {
                            path.OutputExpression = value;
                            dataSourceShape.Paths.Add(path);
                        }
                    }
                }
            }
            return(recSet);
        }
Beispiel #3
0
        public virtual RecordsetList FetchRecordset(WcfService wcfService)
        {
            if (wcfService == null)
            {
                throw new ArgumentNullException(nameof(wcfService));
            }
            var broker            = new WcfSource();
            var outputDescription = broker.ExecuteMethod(wcfService);
            var dataSourceShape   = outputDescription.DataSourceShapes[0];
            var recSet            = outputDescription.ToRecordsetList(wcfService.Recordsets, GlobalConstants.PrimitiveReturnValueTag);

            if (recSet != null)
            {
                foreach (var recordset in recSet)
                {
                    FetchRecordsetFields_WcfService(dataSourceShape, recordset);
                }
            }
            return(recSet);
        }