@@ -41,8 +41,7 @@ public static void TraceContext(this ITracingService tracingservice, IExecutionC
4141 {
4242 try
4343 {
44- tracingservice . TraceContext ( context , parentcontext , attributetypes , convertqueries , expandcollections ,
45- service , 1 ) ;
44+ tracingservice . TraceContext ( context , parentcontext , attributetypes , convertqueries , expandcollections , service , 1 ) ;
4645 }
4746 catch ( Exception ex )
4847 {
@@ -113,12 +112,16 @@ public static string ValueToString(object value, bool attributetypes, bool conve
113112 else if ( value is EntityCollection collection )
114113 {
115114 var result = $ "{ collection . EntityName } collection\n Records: { collection . Entities . Count } \n TotalRecordCount: { collection . TotalRecordCount } \n MoreRecords: { collection . MoreRecords } \n PagingCookie: { collection . PagingCookie } ";
116- if ( expandcollections )
115+ if ( expandcollections && collection . Entities . Count > 0 )
117116 {
118- result += $ "\n { indentstring } { string . Join ( $ " \n { indentstring } " , collection . Entities . Select ( e => ValueToString ( e , attributetypes , convertqueries , expandcollections , service , indent + 1 ) ) ) } " ;
117+ result += "\n " + ValueToString ( collection . Entities , attributetypes , convertqueries , expandcollections , service , indent + 1 ) ;
119118 }
120119 return result ;
121120 }
121+ else if ( value is IEnumerable < Entity > entities )
122+ {
123+ return expandcollections ? $ "{ indentstring } { string . Join ( $ "\n { indentstring } ", entities . Select ( e => ValueToString ( e , attributetypes , convertqueries , expandcollections , service , indent + 1 ) ) ) } " : string . Empty ;
124+ }
122125 else if ( value is Entity entity )
123126 {
124127 var keylen = entity . Attributes . Count > 0 ? entity . Attributes . Max ( p => p . Key . Length ) : 50 ;
@@ -167,4 +170,4 @@ public static void Write(this ITracingService tracer, string text)
167170 tracer . Trace ( DateTime . Now . ToString ( "HH:mm:ss.fff " ) + text ) ;
168171 }
169172 }
170- }
173+ }
0 commit comments