public static void Write(TextWriter writer, Expression expression, List <object> parameters)
        {
            expression = AiPartialEvaluator.Eval(expression);
            var simple = new SimpleParameterizedWriterSql(writer, parameters);

            simple.Visit(expression);
        }
Пример #2
0
        /// <summary>
        /// 将Lambda表达式解析成参数化的SQL语句
        /// </summary>
        /// <param name="expression">表达式</param>
        /// <param name="parameters">参数列表</param>
        /// <returns></returns>
        public static string ToParameterizedMSSqlString(this Expression expression, out List <object> parameters)
        {
            parameters = new List <object>();
            StringWriter writer = new StringWriter();

            SimpleParameterizedWriterSql.Write(writer, expression, parameters);
            return(writer.ToString());
        }