Beispiel #1
0
        /// <summary>
        /// 查询对象
        /// </summary>
        /// <param name="express"></param>
        /// <returns></returns>
        public virtual T Query(Expression <Func <T, bool> > express)
        {
            Func <PropertyInfo[], string, IDictionary <string, object>, T> excute = (propertys, condition, parameters) =>
            {
                string sql        = "select {0} from {1} {2}";
                string combineSql = string.Format(sql, string.Join(",", propertys.Select(x => x.Name)), tableName, condition);
                return(context.ExecuteReader <T>(combineSql, parameters));
            };

            return(CreateExcute <T>(express, excute));
        }