Skip to content

Commit c89306f

Browse files
committed
- Fix collection serialization para rest procedures and dataproviders output
106797
1 parent 7968b35 commit c89306f

File tree

1 file changed

+35
-17
lines changed

1 file changed

+35
-17
lines changed

dotnet/src/dotnetframework/GxClasses/Services/GxRestWrapper.cs

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -349,35 +349,53 @@ public virtual Task MethodUrlExecute(object key)
349349
bool GetWrappedStatus(GXBaseObject worker, bool defaultWrapped, Dictionary<string, object> outputParameters, int parCount, int originalParCount)
350350
{
351351
bool wrapped = defaultWrapped;
352+
352353
if (worker.IsApiObject)
353354
{
354355
if (outputParameters.Count == 1)
355356
{
356357
if ((originalParCount == 1) || (originalParCount > 1 && !Preferences.WrapSingleApiOutput))
357-
{
358-
wrapped = false;
359-
Object v = outputParameters.First().Value;
360-
361-
if (v.GetType().GetInterfaces().Contains(typeof(IGxGenericCollectionWrapped)))
362-
{
363-
IGxGenericCollectionWrapped icollwrapped = v as IGxGenericCollectionWrapped;
364-
if (icollwrapped != null)
365-
wrapped = icollwrapped.GetIsWrapped();
366-
}
367-
if (v is IGxGenericCollectionItem item)
368-
{
369-
if (item.Sdt is GxSilentTrnSdt)
370-
{
371-
wrapped = (parCount > 1) ? true : false;
372-
}
373-
}
358+
{
359+
wrapped = GetCollectionWrappedStatus(outputParameters, parCount, false, true);
374360
}
375361
if (originalParCount > 1 && Preferences.WrapSingleApiOutput)
376362
{
377363
wrapped = true; //Ignore defaultWrapped parameter.
378364
}
379365
}
380366
}
367+
else
368+
{
369+
if (originalParCount == 1)
370+
wrapped = GetCollectionWrappedStatus(outputParameters, parCount, wrapped, false);
371+
372+
}
373+
return wrapped;
374+
}
375+
376+
377+
private bool GetCollectionWrappedStatus(Dictionary<string, object> outputParameters , int parCount, bool defaultWrapped, bool isAPI)
378+
{
379+
380+
Object v = outputParameters.First().Value;
381+
bool wrapped = defaultWrapped;
382+
if (v.GetType().GetInterfaces().Contains(typeof(IGxGenericCollectionWrapped)))
383+
{
384+
IGxGenericCollectionWrapped icollwrapped = v as IGxGenericCollectionWrapped;
385+
if (icollwrapped != null)
386+
wrapped = icollwrapped.GetIsWrapped();
387+
}
388+
389+
if (isAPI)
390+
{
391+
if (v is IGxGenericCollectionItem item)
392+
{
393+
if (item.Sdt is GxSilentTrnSdt)
394+
{
395+
wrapped = (parCount > 1) ? true : false;
396+
}
397+
}
398+
}
381399
return wrapped;
382400
}
383401

0 commit comments

Comments
 (0)