Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions dotnet/src/dotnetframework/GxClasses/Services/GxRestWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@ internal static class Synchronizer
internal const string SYNCHRONIZER_INFO = "gxTpr_Synchronizer";
}

public class OrderedContractResolver : Newtonsoft.Json.Serialization.DefaultContractResolver
{
protected override System.Collections.Generic.IList<Newtonsoft.Json.Serialization.JsonProperty> CreateProperties(System.Type type, Newtonsoft.Json.MemberSerialization memberSerialization)
{
return base.CreateProperties(type, memberSerialization).OrderBy(p => p.PropertyName).ToList();
}
}

#if NETCORE
public class GxRestWrapper
#else
Expand Down Expand Up @@ -141,7 +133,7 @@ public virtual Task MethodBodyExecute(object key)
setWorkerStatus(_procWorker);
_procWorker.cleanup();
RestProcess(outputParameters);
return Serialize(outputParameters, wrapped, _procWorker.IsApiObject);
return Serialize(outputParameters, wrapped);
}
catch (Exception e)
{
Expand Down Expand Up @@ -283,7 +275,7 @@ public virtual Task MethodUrlExecute(object key)
RestProcess(outputParameters);
bool wrapped = false;
wrapped = GetWrappedStatus(_procWorker, wrapped, outputParameters);
return Serialize(outputParameters, wrapped, _procWorker.IsApiObject);
return Serialize(outputParameters, wrapped);
}
catch (Exception e)
{
Expand Down Expand Up @@ -636,12 +628,10 @@ public Task WebException(Exception ex)
GXLogging.Error(log, "WebException", ex);
return SetError("500", ex.Message);
}
protected Task Serialize(Dictionary<string, object> parameters, bool wrapped, bool ordered)
protected Task Serialize(Dictionary<string, object> parameters, bool wrapped)
{
var serializer = new Newtonsoft.Json.JsonSerializer();

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