@@ -72,30 +72,15 @@ public IInsertOrUpdate<T1> UpdateColumns(string[] columns)
7272 public static void AuditDataValue ( object sender , IEnumerable < T1 > data , IFreeSql orm , TableInfo table , Dictionary < string , bool > changedDict )
7373 {
7474 if ( data ? . Any ( ) != true ) return ;
75- if ( orm . Aop . AuditValueHandler == null ) return ;
7675 foreach ( var d in data )
77- {
78- if ( d == null ) continue ;
79- foreach ( var col in table . Columns . Values )
80- {
81- object val = col . GetValue ( d ) ;
82- var auditArgs = new Aop . AuditValueEventArgs ( Aop . AuditValueType . InsertOrUpdate , col , table . Properties [ col . CsName ] , val ) ;
83- orm . Aop . AuditValueHandler ( sender , auditArgs ) ;
84- if ( auditArgs . ValueIsChanged )
85- {
86- col . SetValue ( d , val = auditArgs . Value ) ;
87- if ( changedDict != null && changedDict . ContainsKey ( col . Attribute . Name ) == false )
88- changedDict . Add ( col . Attribute . Name , true ) ;
89- }
90- }
91- }
76+ AuditDataValue ( sender , d , orm , table , changedDict ) ;
9277 }
9378 public static void AuditDataValue ( object sender , T1 data , IFreeSql orm , TableInfo table , Dictionary < string , bool > changedDict )
9479 {
95- if ( orm . Aop . AuditValueHandler == null ) return ;
9680 if ( data == null ) return ;
9781 if ( typeof ( T1 ) == typeof ( object ) && new [ ] { table . Type , table . TypeLazy } . Contains ( data . GetType ( ) ) == false )
9882 throw new Exception ( $ "操作的数据类型({ data . GetType ( ) . DisplayCsharp ( ) } ) 与 AsType({ table . Type . DisplayCsharp ( ) } ) 不一致,请检查。") ;
83+ if ( orm . Aop . AuditValueHandler == null ) return ;
9984 foreach ( var col in table . Columns . Values )
10085 {
10186 object val = col . GetValue ( data ) ;
0 commit comments