Skip to content

Commit 8ab5213

Browse files
committed
- fix default case for serialization of lists in dataproviders rest with Json response
1 parent 3f361dc commit 8ab5213

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -879,9 +879,9 @@ protected static object MakeRestType( object collectionValue, bool isApiObject)
879879
Type vType = collectionValue.GetType();
880880
Type itemType;
881881
if (vType.IsConstructedGenericType && typeof(IGxCollection).IsAssignableFrom(vType))
882-
{
883-
bool isWrapped = false;
884-
object collectionObject = null;
882+
{
883+
bool isWrapped = (isApiObject)?false:true;
884+
object collectionObject = null;
885885
string wrappedStatus = "";
886886
Type restItemType=null;
887887
itemType = collectionValue.GetType().GetGenericArguments()[0];
@@ -899,7 +899,7 @@ protected static object MakeRestType( object collectionValue, bool isApiObject)
899899
{
900900
GxJsonSerialization attFmt = (GxJsonSerialization)serializationAttributes.FirstOrDefault();
901901
wrappedStatus = attFmt.JsonUnwrapped;
902-
isWrapped = (attFmt.JsonUnwrapped == "wrapped")? true:false;
902+
isWrapped = (isApiObject)? ((wrappedStatus == "wrapped")? true: false): ((wrappedStatus == "unwrapped") ? false : true);
903903
}
904904
bool isEmpty = !restItemType.IsDefined(typeof(GxOmitEmptyCollection), false);
905905
Type genericListItemType = typeof(GxGenericCollection<>).MakeGenericType(restItemType);

dotnet/src/extensions/Azure/test/GeneXus.Programs.Common/type_SdtEventMessageProperty.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ public void initialize( )
138138
}
139139
#region Rest interface
140140
[GxUnWrappedJson()]
141+
[GxJsonSerialization("default")]
141142
[DataContract(Name=@"EventMessageProperty", Namespace="ServerlessAPI")]
142143
public class SdtEventMessageProperty_RESTInterface : GxGenericCollectionItem<SdtEventMessageProperty>, System.Web.SessionState.IRequiresSessionState
143144
{

dotnet/src/extensions/Azure/test/GeneXus.Programs.Common/type_SdtEventMessageResponse.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ public void initialize()
131131
}
132132
#region Rest interface
133133
[GxUnWrappedJson()]
134+
[GxJsonSerialization("default")]
134135
[DataContract(Name = @"EventMessageResponse", Namespace = "GeneXus")]
135136
public class SdtEventMessageResponse_RESTInterface : GxGenericCollectionItem<SdtEventMessageResponse>, System.Web.SessionState.IRequiresSessionState
136137
{

0 commit comments

Comments
 (0)