Ejemplo n.º 1
0
        /// <summary>
        /// 执行入口,解析表达式生成SQL语句,并返回SQL数据源数据
        /// </summary>
        /// <param name="expression"></param>
        /// <returns></returns>
        public object Execute(Expression expression)
        {
            var translator = new SqlTranslate();
            var trans      = translator.Translate(expression);

            //var elist= SqlMapper.Query(_conn, trans.Item1, trans.Item2);
            //return elist;
            System.Diagnostics.Debug.WriteLine($"sql:{trans.Item1}");
            return(null);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 执行入口,解析表达式生成SQL语句,并返回SQL数据源一行数据
        /// </summary>
        /// <typeparam name="TResult"></typeparam>
        /// <param name="expression"></param>
        /// <returns></returns>
        public TResult Execute <TResult>(Expression expression)
        {
            var translator = new SqlTranslate();
            var trans      = translator.Translate(expression);

            //return SqlMapper.Query<TResult>(_conn, trans.Item1, trans.Item2).FirstOrDefault();

            System.Diagnostics.Debug.WriteLine($"sql:{trans.Item1}");
            return(default(TResult));

            //return default(TResult);
            //return (TResult)this.Execute(expression);
        }