public virtual void Wrap(Scope scope) { IsWrapped = true; if (scope == null) return; if (Left != null) scope.Remove(Left); if (Right != null) scope.Remove(Right); }
void AddDefaultColumns(Scope scope) { if (columnHash == null) columnHash = new Dictionary<string, ColumnFragment>(); List<ColumnFragment> columns = GetDefaultColumnsForFragment(From); bool Exists = false; if (From is TableFragment && scope.GetFragment((From as TableFragment).Table) == null) { scope.Add((From as TableFragment).Table, From); Exists = true; } foreach (ColumnFragment column in columns) { // first we need to set the input for this column InputFragment input = scope.FindInputFromProperties(column.PropertyFragment); column.TableName = input.Name; // then we rename the column if necessary if (columnHash.ContainsKey(column.ColumnName.ToUpper())) { column.ColumnAlias = MakeColumnNameUnique(column.ColumnName); columnHash.Add(column.ColumnAlias, column); } else columnHash.Add(column.ColumnName.ToUpper(), column); Columns.Add(column); } if (From is TableFragment && Exists) { scope.Remove(From); } }
internal void AddColumn(ColumnFragment column, Scope scope) { InputFragment input = scope.FindInputFromProperties(column.PropertyFragment); column.TableName = input.Name; // then we rename the column if necessary if (columnHash.ContainsKey(column.ColumnName.ToUpper())) { column.ColumnAlias = MakeColumnNameUnique(column.ColumnName); columnHash.Add(column.ColumnAlias, column); } else { if( !string.IsNullOrEmpty(column.ColumnAlias) ) columnHash.Add(column.ColumnAlias.ToUpper(), column); else columnHash.Add(column.ColumnName.ToUpper(), column); } Columns.Add(column); }
public override void Wrap(Scope scope) { base.Wrap(scope); // now we need to add default columns if necessary if (Columns.Count == 0) AddDefaultColumns(scope); // next we need to remove child extents of the select from scope if (Name != null) { scope.Remove(this); scope.Add(Name, this); } }
void AddDefaultColumns(Scope scope) { if (columnHash == null) columnHash = new Dictionary<string, ColumnFragment>(); List<ColumnFragment> columns = GetDefaultColumnsForFragment(From); foreach (ColumnFragment column in columns) { // first we need to set the input for this column InputFragment input = scope.FindInputFromProperties(column.PropertyFragment); column.TableName = input.Name; // then we rename the column if necessary if (columnHash.ContainsKey(column.ColumnName)) { column.ColumnAlias = MakeColumnNameUnique(column.ColumnName); columnHash.Add(column.ColumnAlias, column); } else columnHash.Add(column.ColumnName, column); Columns.Add(column); } }