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

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