public override ICloneableElement Clone(Dictionary <ICloneableElement, ICloneableElement> objectTree, Predicate <ICloneableElement> doClone) { if (!doClone(this)) { return(this); } ICloneableElement clone; if (!objectTree.TryGetValue(this, out clone)) { var qs = CloneInstance(objectTree, doClone); objectTree.Add(this, qs); qs.SqlQuery = (SqlQuery)SqlQuery.Clone(objectTree, doClone); qs.Lambda = Lambda; qs._sources = Array.ConvertAll(Sources, q => (QuerySource)q.Clone(objectTree, doClone)); qs._fields = Fields.ConvertAll(f => (QueryField)f.Clone(objectTree, doClone)); clone = qs; } return(clone); }
internal Content DeepCopy(ReferenceDictionary <object, object> visited) { if (visited.TryGetValue(this, out object value)) { return((Content)value); } var content = (Content)MemberwiseClone(); visited[this] = content; content.Fields = Fields?.ConvertAll(field => field.DeepCopy(visited)); return(content); }