示例#1
0
        /// <summary>
        /// 从XML中获取SQL查询
        /// </summary>
        /// <typeparam name="TResult"></typeparam>
        /// <param name="id"></param>
        /// <param name="dic"></param>
        /// <returns></returns>
        public IEnumerable <TResult> QueryXml <TResult>(string id, Dictionary <string, string> dic = null)
        {
            XmlSqlModel xsm = CheckXml(id, out string msg);

            if (xsm == null)
            {
                throw new Exception(msg);
            }
            DynamicParameters param = ConvertDicToParam(dic, xsm.Sql, out string sql);

            return(QueryBySql <TResult>(sql, dic));
        }
示例#2
0
        /// <summary>
        /// 从XML中获取SQL执行
        /// </summary>
        /// <param name="id"></param>
        /// <param name="dic"></param>
        /// <returns></returns>
        public bool ExecuteXml(string id, Dictionary <string, string> dic = null)
        {
            XmlSqlModel xsm = CheckXml(id, out string msg);

            if (xsm == null)
            {
                throw new Exception(msg);
            }
            DynamicParameters param = ConvertDicToParam(dic, xsm.Sql, out string sql);

            return(ExecuteSql(sql, dic));
        }