public object Clone() { var clone = new SqlCommandText(CommandText); clone.AddParameters(this); return(clone); }
public void AddParameters(SqlCommandText source) { foreach (KeyValuePair <string, object> parameter in source.Parameters) { Parameters.Add(parameter.Key, parameter.Value); } }
public SqlCommandText Concat(SqlCommandText other) { if (IsEmpty) { return((SqlCommandText)other.Clone()); } if (other.IsEmpty) { return((SqlCommandText)Clone()); } var concatenatedCommandText = new SqlCommandText($"({CommandText}) AND ({other.CommandText})"); concatenatedCommandText.AddParameters(this); concatenatedCommandText.AddParameters(other); return(concatenatedCommandText); }