1.更新单个字段
/// <summary> /// 更新字段 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="conditions">where 筛选对象</param> /// <param name="updateLamda">更新字段</param> /// <returns></returns> public IEnumerable<T> Update<T>( Expression<Func<T, bool>> conditions,Func<T, dynamic> updateLamda) where T : ModelBase { List<T> setList; if (conditions!=null) { setList= this.Set<T>().Where(conditions).ToList(); } else { setList = this.Set<T>().ToList(); } foreach (var item in setList) { SetValue<T>(item, updateLamda);