internal void AddSqlTextWithParameter(string s, QueryParameter p) { if (string.IsNullOrEmpty(s)) { int num = this.int_0++; s = this.funcAddPrefix("p" + num.ToString()); } this.ParametersDict.Add(new KeyValuePair<string, QueryParameter>(s, p)); }
private void AddParameter(QueryParameter p) { if (this.AutoDiscoverParameters && (this.spstep == SPStep.Skip)) { throw new InvalidOperationException("正在等待以单引号开始的字符串,此时不允许再拼接其它参数。"); } string str = "p" + this.int_0++.ToString(); if (this.funcParameterQueryDelegate == this.funcAddPrefix) { string str2 = this.funcParameterQueryDelegate(str); this.stringBuilder.Append(str2); this.ParametersDict.Add(new KeyValuePair<string, QueryParameter>(str2, p)); } else { this.stringBuilder.Append(this.funcParameterQueryDelegate(str)); this.ParametersDict.Add(new KeyValuePair<string, QueryParameter>(this.funcAddPrefix(str), p)); } if (this.AutoDiscoverParameters && (this.spstep == SPStep.EndWith)) { this.spstep = SPStep.Skip; } }
public CPQuery AppendFrom(string parameterizedSQL, object argsObject) { if (string.IsNullOrEmpty(parameterizedSQL)) { throw new ArgumentNullException("parameterizedSQL"); } this.stringBuilder.Append(parameterizedSQL); if (argsObject != null) { foreach (PropertyInfo info in argsObject.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) { QueryParameter parameter = new QueryParameter(info.GetPropertyValue(argsObject)); this.AddSqlTextWithParameter(this.funcAddPrefix(info.Name), parameter); } } return this; }