Example #1
0
        /// <summary>
        /// 自定义数据库查询.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="expression"></param>
        /// <returns></returns>
        public IEnumerable <T> Query <T>(Action <SqlExp <T> > expression)
        {
            using (var conn = DbConnFactory.Open(DbName))
            {
                var exp = SqlExp <T> .GetSqlExp(conn);

                expression(exp);
                return(conn.Select(exp.GetExp()));
            }
        }