private void Condition(string field, object value, QueryOperator oper = QueryOperator.Equals) { if (m_parameters == null) { m_builder.AppendFormat(" {0} {1} {2}", Quote(field), GetOperatorChar(oper), ConvertValue(value)); } else { m_builder.AppendFormat(" {0} {1} {2}p{3}", Quote(field), GetOperatorChar(oper), m_syntax.ParameterPrefix, m_parameters.Count); var parameter = new Parameter(string.Format("p{0}", m_parameters.Count)); value.As <PropertyValue>(v => PropertyValueHelper.Set(v, parameter), () => parameter.Value = value); m_parameters.Add(parameter); } }
private EntityQueryBuilder SetByInsert(params QueryValue[] values) { var flag = new AssertFlag(); m_builder.Append("("); var realValues = values.Where(s => s.Property is ISavedProperty); foreach (var value in realValues) { if (!flag.AssertTrue()) { m_builder.Append(", "); } m_builder.Append(QuoteColumn(value.Property)); } m_builder.Append(") VALUES("); flag.Reset(); foreach (var value in realValues) { if (!flag.AssertTrue()) { m_builder.Append(", "); } if (m_parameters == null) { m_builder.Append(ConvertValue(value.Value)); } else { m_builder.AppendFormat("{0}p{1}", m_syntax.ParameterPrefix, m_parameters.Count); var parameter = new Parameter(string.Format("p{0}", m_parameters.Count)); value.Value.As <PropertyValue>(v => PropertyValueHelper.Set(v, parameter), () => parameter.Value = value.Value); m_parameters.Add(parameter); } } m_builder.Append(")"); return(this); }