原文 automapper如何全局配置map条件过滤null值空值对所有映射起效 我们在使用automapper的时候经常会遇到这样的问题:假设展示给用户的数据我们用UserDto类,User类就是我们的实体类.在给用户编辑的时候,我们可能某些字段在数据库中为Null,这时候需要一些默认值 比如这里UserDto中的BirTime,然后我们有一些人的习惯是在构造函数里面进行赋值 public class User { public int Id { get; set; } public stri…
在hive中,我们经常会遇到对某列进行count.sum.avg等操作计算记录数.求和.求平均值等,但这列经常会出现有null值的情况,那这些操作会不会过滤掉null能呢? 下面我们简单测试下: with tmp as(select null as col1 union allselect 666 as col1 union allselect 999 as col1)select avg(col1) avg_numm, sum(col1) sum_num, count(1) cnt, coun…
public T Update<T>(T entity) where T : ModelBase { var set = this.Set<T>(); set.Attach(entity); foreach (System.Reflection.PropertyInfo p in entity.GetType().GetProperties()) { if (p.GetValue(entity) != null) { this.Entry<T>(entity).Prop…