Exemplo n.º 1
0
        /// <summary>
        /// 将Request里的参数转成SqlParameter[]
        /// </summary>
        /// <returns></returns>
        internal static void RequestParasToSqlParameters(MySqlParameterCollection oldParas)
        {
            var oldParaList      = oldParas.Cast <MySqlParameter>().ToList();
            var paraDictionarAll = SqlSugarTool.GetParameterDictionary();

            if (paraDictionarAll != null && paraDictionarAll.Count() > 0)
            {
                foreach (KeyValuePair <string, string> it in paraDictionarAll)
                {
                    var par = new MySqlParameter("@" + it.Key, it.Value);
                    if (!oldParaList.Any(oldPara => oldPara.ParameterName == ("@" + it.Key)))
                    {
                        oldParas.Add(par);
                    }
                }
            }
        }