Skip to content

Commit 69f1f34

Browse files
committed
Remove order of properties in serialized JSON. #333
1 parent 13ee92d commit 69f1f34

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

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

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,7 @@ internal static class Synchronizer
4040
internal const string SYNCHRONIZER_INFO = "gxTpr_Synchronizer";
4141
}
4242

43-
public class OrderedContractResolver : Newtonsoft.Json.Serialization.DefaultContractResolver
44-
{
45-
protected override System.Collections.Generic.IList<Newtonsoft.Json.Serialization.JsonProperty> CreateProperties(System.Type type, Newtonsoft.Json.MemberSerialization memberSerialization)
46-
{
47-
return base.CreateProperties(type, memberSerialization).OrderBy(p => p.PropertyName).ToList();
48-
}
49-
}
50-
43+
5144
#if NETCORE
5245
public class GxRestWrapper
5346
#else
@@ -133,7 +126,7 @@ public virtual Task MethodBodyExecute(object key)
133126
setWorkerStatus(_procWorker);
134127
_procWorker.cleanup();
135128
RestProcess(outputParameters);
136-
return Serialize(outputParameters, wrapped, _procWorker.IsApiObject);
129+
return Serialize(outputParameters, wrapped);
137130
}
138131
catch (Exception e)
139132
{
@@ -281,7 +274,7 @@ public virtual Task MethodUrlExecute(object key)
281274
wrapped = true;
282275
}
283276
}
284-
return Serialize(outputParameters, wrapped, _procWorker.IsApiObject);
277+
return Serialize(outputParameters, wrapped);
285278
}
286279
catch (Exception e)
287280
{
@@ -611,12 +604,10 @@ public Task WebException(Exception ex)
611604
GXLogging.Error(log, "WebException", ex);
612605
return SetError("500", ex.Message);
613606
}
614-
protected Task Serialize(Dictionary<string, object> parameters, bool wrapped, bool ordered)
607+
protected Task Serialize(Dictionary<string, object> parameters, bool wrapped)
615608
{
616609
var serializer = new Newtonsoft.Json.JsonSerializer();
617610

618-
if (ordered)
619-
serializer.ContractResolver = new OrderedContractResolver();
620611
serializer.Converters.Add(new SDTConverter());
621612
TextWriter ms = new StringWriter();
622613
if (parameters.Count == 1 && !wrapped) //In Dataproviders, with one parameter BodyStyle is WebMessageBodyStyle.Bare, Both requests and responses are not wrapped.

0 commit comments

Comments
 (0)