Ejemplo n.º 1
0
        /// <summary>
        /// 格式化为更新值查询
        /// </summary>
        /// <param name="setValue"></param>
        /// <returns></returns>
        string ForamtSetValue <T>(ParameCollection setValue) where T : IModel
        {
            string tableName = TypeCache.GetTableName(typeof(T));
            string setString = "";

            foreach (var pair in setValue)
            {
                string name  = pair.Key;
                object value = pair.Value;
                value = ObjectConvert.SetNullValue(value);
                if (name.StartsWith("$"))//直接按值拼接 c2["$SoldCount"] = "SoldCount+" + num;
                {
                    name       = name.Substring(1, name.Length - 1);
                    setString += string.Format(" {0}={1},", name, value);
                }
                else
                {
                    setString += string.Format(" {0}=@{0},", name);
                    helper.AddParam(name, value);
                }
            }
            setString = setString.Substring(0, setString.Length - 1);
            return(setString);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 设置参数
 /// </summary>
 /// <param name="name"></param>
 /// <param name="value"></param>
 public void SetParam(string name, object value)
 {
     value = ObjectConvert.SetNullValue(value);
     helper.SetParam(name, value);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 增加参数
 /// </summary>
 /// <param name="name"></param>
 /// <param name="value"></param>
 public void AddParam(string name, object value)
 {
     value = ObjectConvert.SetNullValue(value);
     dbHelper.AddParam(name, value);
 }