示例#1
0
        public override void AddRequiredColumns(IDictionary <string, DataSource> dataSources, IDictionary <string, Type> parameterTypes, IList <string> requiredColumns)
        {
            if (JoinCondition != null)
            {
                foreach (var col in JoinCondition.GetColumns())
                {
                    if (!requiredColumns.Contains(col, StringComparer.OrdinalIgnoreCase))
                    {
                        requiredColumns.Add(col);
                    }
                }
            }

            var leftSchema  = LeftSource.GetSchema(dataSources, parameterTypes);
            var leftColumns = requiredColumns
                              .Where(col => leftSchema.ContainsColumn(col, out _))
                              .Concat((IEnumerable <string>)OuterReferences?.Keys ?? Array.Empty <string>())
                              .Distinct()
                              .ToList();
            var innerParameterTypes = GetInnerParameterTypes(leftSchema, parameterTypes);
            var rightSchema         = RightSource.GetSchema(dataSources, innerParameterTypes);
            var rightColumns        = requiredColumns
                                      .Where(col => rightSchema.ContainsColumn(col, out _))
                                      .Concat(DefinedValues.Values)
                                      .Distinct()
                                      .ToList();

            LeftSource.AddRequiredColumns(dataSources, parameterTypes, leftColumns);
            RightSource.AddRequiredColumns(dataSources, parameterTypes, rightColumns);
        }