Ejemplo n.º 1
0
        /**
         * @ 初始化SQL插入语句,该方法使用反射,性能有所降低,请酌情使用
         * @  obj 要删除对象,必须给主键配置特性LdfSQLEntityKey.PrimaryKey=true
         * */
        public void UpdateObject <T>(T obj, params string[] filterFields) where T : class, new()
        {
            PropertyInfo[] piArray = obj.GetType().GetProperties();
            int            len     = piArray.Length;

            for (int i = 0; i < len; i++)
            {
                PropertyInfo pi = piArray[i];
                if (filterFields.Contains <string>(pi.Name))
                {
                    continue;
                }

                ArrayUpdate.Add(pi.Name, pi.GetValue(obj, null));
            }
        }
Ejemplo n.º 2
0
 /**
  * @ 初始化SQL插入语句,fields和values数组长度必须一致
  * @ fields 要更新的字段名称
  * @ values 字段对应的值
  * */
 public void AddUpdate(string field, object value)
 {
     ArrayUpdate.Add(field, value);
 }