internal override object Clone(SqlNodeCloneContext context) { if (context.NodeMapping.ContainsKey(this)) { return(context.NodeMapping[this]); } SqlSelect clone = new SqlSelect(from == null ? null : (SqlTable)from.Clone(context)); foreach (SqlColumn c in columns) { clone.Columns.Add((SqlColumn)c.Clone(context)); } if (groupBy != null) { foreach (SqlColumn c in groupBy) { clone.GroupBy.Add((SqlColumn)c.Clone(context)); } } if (!where.IsNullReference()) { clone.Where = (SqlExpression) where.Clone(context); } if (!having.IsNullReference()) { clone.Having = (SqlExpression)having.Clone(context); } if (orderBy != null) { foreach (SqlOrder so in orderBy) { clone.OrderBy.Add((SqlOrder)so.Clone(context)); } } clone.Distinct = distinct; clone.Limit = Limit; clone.Offset = Offset; clone.Lock = Lock; if (Hints.Count > 0) { foreach (SqlHint hint in Hints) { clone.Hints.Add((SqlHint)hint.Clone(context)); } } context.NodeMapping[this] = clone; return(clone); }
internal override object Clone(SqlNodeCloneContext context) { if (context.NodeMapping.ContainsKey(this)) { return(context.NodeMapping[this]); } SqlSubQuery clone; SqlSelect select = query as SqlSelect; SqlQueryExpression expression = query as SqlQueryExpression; if (select != null) { clone = new SqlSubQuery((SqlSelect)select.Clone(context)); } else { clone = new SqlSubQuery((SqlQueryExpression)expression.Clone(context)); } context.NodeMapping[this] = clone; return(clone); }