Ejemplo n.º 1
0
        protected virtual RecordsetList FetchRecordset(ComPluginService pluginService, bool addFields)
        {
            if (pluginService == null)
            {
                throw new ArgumentNullException(nameof(pluginService));
            }
            var broker            = new ComPluginBroker();
            var outputDescription = broker.TestPlugin(pluginService);
            var dataSourceShape   = outputDescription.DataSourceShapes[0];
            var recSet            = outputDescription.ToRecordsetList(pluginService.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;
                            var foundPath = dataSourceShape.Paths.FirstOrDefault(path1 => path1.OutputExpression == path.OutputExpression);
                            if (foundPath == null)
                            {
                                dataSourceShape.Paths.Add(path);
                            }
                            else
                            {
                                foundPath.OutputExpression = path.OutputExpression;
                            }
                        }
                    }
                }
            }
            return(recSet);
        }
Ejemplo n.º 2
0
        protected virtual RecordsetList FetchRecordset(ComPluginService pluginService, bool addFields)
        {
            if (pluginService == null)
            {
                throw new ArgumentNullException(nameof(pluginService));
            }
            var broker            = new ComPluginBroker();
            var outputDescription = broker.TestPlugin(pluginService);
            var dataSourceShape   = outputDescription.DataSourceShapes[0];
            var recSet            = outputDescription.ToRecordsetList(pluginService.Recordsets, GlobalConstants.PrimitiveReturnValueTag);

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