File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
src/Libraries/SmartStore.Services/Messages Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -1177,22 +1177,24 @@ private IEnumerable<TreeNode<ModelTreeMember>> BuildModelTreePartForClass(object
1177
1177
{
1178
1178
yield return new TreeNode < ModelTreeMember > ( new ModelTreeMember { Name = prop . Name , Kind = ModelTreeMemberKind . Collection } ) ;
1179
1179
}
1180
- else
1180
+ else if ( pi . PropertyType . IsClass )
1181
1181
{
1182
1182
if ( instanceLookup == null )
1183
1183
{
1184
- instanceLookup = new HashSet < object > ( ReferenceEqualityComparer . Default ) ;
1184
+ instanceLookup = new HashSet < object > ( ReferenceEqualityComparer . Default ) { instance } ;
1185
1185
}
1186
1186
1187
- var exists = ! type . IsValueType && instanceLookup . Contains ( instance ) ;
1188
-
1189
- if ( ! exists )
1187
+ var childInstance = prop . GetValue ( instance ) ;
1188
+ if ( childInstance != null )
1190
1189
{
1191
- instanceLookup . Add ( instance ) ;
1190
+ if ( ! instanceLookup . Contains ( childInstance ) )
1191
+ {
1192
+ instanceLookup . Add ( childInstance ) ;
1192
1193
1193
- var node = new TreeNode < ModelTreeMember > ( new ModelTreeMember { Name = prop . Name , Kind = ModelTreeMemberKind . Complex } ) ;
1194
- node . AppendRange ( BuildModelTreePartForClass ( prop . GetValue ( instance ) , instanceLookup ) ) ;
1195
- yield return node ;
1194
+ var node = new TreeNode < ModelTreeMember > ( new ModelTreeMember { Name = prop . Name , Kind = ModelTreeMemberKind . Complex } ) ;
1195
+ node . AppendRange ( BuildModelTreePartForClass ( childInstance , instanceLookup ) ) ;
1196
+ yield return node ;
1197
+ }
1196
1198
}
1197
1199
}
1198
1200
}
You can’t perform that action at this time.
0 commit comments