1010using System . Data . Common ;
1111using System . Linq ;
1212using System . Reflection ;
13- using T = System . Collections . Generic . Dictionary < string , object > ;
13+ using T = System . Collections . Generic . IDictionary < string , object > ;
1414
1515namespace FreeSql . Extensions . ZeroEntity
1616{
@@ -607,7 +607,7 @@ object LocalAuditJsonElement(Func<object, object> resetValue, object value)
607607 {
608608 var valueEach = _AuditJsonElementMethodJsonElementEnumerateObject . Invoke ( value , new object [ 0 ] ) as IEnumerable ;
609609 if ( valueEach == null ) return resetValue ? . Invoke ( null ) ;
610- var newValue = new T ( ) ;
610+ var newValue = new Dictionary < string , object > ( ) ;
611611 foreach ( var valueItem in valueEach )
612612 {
613613 if ( valueItem == null ) continue ;
@@ -1101,7 +1101,7 @@ void LocalAttachCascade(ZeroTableInfo table, T entityFrom, bool flag)
11011101
11021102 var key = GetEntityKeyString ( table , entityFrom ) ;
11031103 if ( key == null ) return ;
1104- var state = new EntityState ( new T ( ) , key ) ;
1104+ var state = new EntityState ( new Dictionary < string , object > ( ) , key ) ;
11051105
11061106 LocalMapEntityValue ( table , entityFrom , state . Value ) ;
11071107
@@ -1140,7 +1140,7 @@ bool LocalMapEntityValue(ZeroTableInfo table, T entityFrom, T entityTo)
11401140 //entityTo.Remove(nav.Key);
11411141 continue ;
11421142 }
1143- var valTo = new T ( ) ;
1143+ var valTo = new Dictionary < string , object > ( ) ;
11441144 SetNavigateRelationshipValue ( nav . Value , entityFrom , valFrom ) ;
11451145 if ( LocalMapEntityValue ( nav . Value . RefTable , valFrom , valTo ) )
11461146 entityTo [ nav . Key ] = valTo ;
@@ -1159,7 +1159,7 @@ bool LocalMapEntityValue(ZeroTableInfo table, T entityFrom, T entityTo)
11591159 foreach ( var fromObj in valFromList )
11601160 {
11611161 if ( fromObj is T fromItem == false || fromItem == null ) continue ;
1162- var toItem = new T ( ) ;
1162+ var toItem = new Dictionary < string , object > ( ) ;
11631163 if ( LocalMapEntityValue ( nav . Value . RefTable , fromItem , toItem ) )
11641164 valTo . Add ( toItem ) ;
11651165 }
@@ -1179,7 +1179,7 @@ bool LocalMapEntityValue(ZeroTableInfo table, T entityFrom, T entityTo)
11791179 {
11801180 if ( fromObj is T fromItem == false || fromItem == null ) continue ;
11811181 LocalAttachCascade ( nav . Value . RefTable , fromItem , includeOutside ) ; //创建新的 states
1182- var toItem = new T ( ) ;
1182+ var toItem = new Dictionary < string , object > ( ) ;
11831183 foreach ( var col in nav . Value . RefTable . Primarys ) //多对多状态只存储 PK
11841184 if ( fromItem . TryGetValue ( col . CsName , out var colval ) )
11851185 toItem [ col . CsName ] = colval ;
@@ -1197,7 +1197,7 @@ bool LocalMapEntityValue(ZeroTableInfo table, T entityFrom, T entityTo)
11971197 continue ;
11981198 }
11991199 LocalAttachCascade ( nav . Value . RefTable , valFrom , includeOutside ) ; //创建新的 states
1200- var valTo = new T ( ) ;
1200+ var valTo = new Dictionary < string , object > ( ) ;
12011201 foreach ( var col in nav . Value . RefTable . Columns . Values )
12021202 if ( valFrom . TryGetValue ( col . CsName , out var colval ) )
12031203 valTo [ col . CsName ] = colval ;
@@ -1568,7 +1568,7 @@ List<T> GetManyToManyObjects(ZeroTableRef nav, T entity, string navName)
15681568 foreach ( var ritem in rights )
15691569 {
15701570 if ( ritem is T right == false || right == null ) continue ;
1571- var midval = new T ( ) ;
1571+ var midval = new Dictionary < string , object > ( ) ;
15721572 for ( var x = 0 ; x < nav . Columns . Count ; x ++ )
15731573 if ( entity . TryGetValue ( nav . Columns [ x ] , out var colval ) )
15741574 midval [ nav . MiddleColumns [ x ] ] = colval ;
0 commit comments