Ejemplo n.º 1
0
        private IList <T> ExecuteIListdDlegate <T>(string sql, object param, ProcessProc r)
        {
            IList <T> list = null;

            using (var con = DbService())
            {
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }

                try
                {
                    string text = r(LoadSql(sql, param));
                    list = con.Query <T>(text, param, null, true, null, CommandType.Text).ToList <T>();
                }
                catch (Exception ex)
                {
                    Log.Error(sql + "  ExecuteIListWithOutTran error", ex);
                    throw ex;
                }
            }
            return(list);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 执行一个sql文件,返回Ilist<T>
 /// </summary>
 /// <typeparam name="T">类型</typeparam>
 /// <param name="sql">sql文件地址</param>
 /// <param name="param">查询参数</param>
 /// <param name="processor">委托</param>
 /// <returns></returns>
 public IList <T> ExecuteIList <T>(string sql, object param, ProcessProc r)
 {
     return(ExecuteIListdDlegate <T>(sql, param, r));
 }