예제 #1
0
        private void BuildPrimitiveExpression(PrimitiveExpression exp, BuildQueryContext ctx)
        {
            if (exp.Value == null)
            {
                ctx.Append("NULL");
                return;
            }

            if (exp.Value is IEnumerable list && !(exp.Value is string)) //用于处理In及NotIn的参数
            {
                ctx.Append("(");
                bool first = true;
                foreach (var item in list)
                {
                    if (first)
                    {
                        first = false;
                    }
                    else
                    {
                        ctx.Append(",");
                    }
                    ctx.AppendFormat("@{0}", ctx.GetParameterName(item));
                }
                ctx.Append(")");
            }