Browse Source

Fixed some problems with Filter converter

Kenric Nugteren 1 week ago
parent
commit
c5b79abb5b

+ 14 - 3
InABox.Core/Query/Filter.cs

@@ -2142,7 +2142,18 @@ namespace InABox.Core
                     }
                 }
                 else if (string.Equals(tag, "Expression"))
-                    propertyName = reader.GetString() ?? "";
+                {
+                    var propName = reader.GetString() ?? "";
+                    if (propName.StartsWith('{'))
+                    {
+                        var exp = CoreUtils.StringToExpression(propName);
+                        propertyName = CoreUtils.ExpressionToString(typeof(object), exp);
+                    }
+                    else
+                    {
+                        propertyName = propName;
+                    }
+                }
                 else if (string.Equals(tag, "Operator"))
                 {
                     op = ReadEnum<Operator>(ref reader);
@@ -2161,7 +2172,7 @@ namespace InABox.Core
                 {
                     while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
                     {
-                        var and = Read(ref reader, typeof(IFilter), options);
+                        var and = Read(ref reader, typeToConvert, options);
                         if (and != null)
                             ands.Add(and);
                     }
@@ -2170,7 +2181,7 @@ namespace InABox.Core
                 {
                     while (reader.Read() && reader.TokenType != JsonTokenType.EndArray)
                     {
-                        var or = Read(ref reader, typeof(IFilter), options);
+                        var or = Read(ref reader, typeToConvert, options);
                         if (or != null)
                             ors.Add(or);
                     }

+ 0 - 1
inabox.client.rest/InABox.Client.Rest/RestClient.cs

@@ -165,7 +165,6 @@ namespace InABox.Clients
         protected TResponse SendRequest<TRequest, TResponse>(TRequest request, string Action, SerializationFormat requestFormat, SerializationFormat responseFormat, bool includeEntity = true)
             where TRequest : Request where TResponse : Response, new()
         {
-
             var result = default(TResponse);
 
             var url = RestClientCache.URL(_server);

+ 0 - 1
inabox.wpf/Dashboard/DynamicDashboard.cs

@@ -92,7 +92,6 @@ public static class DynamicDashboardUtils
     private static JsonSerializerOptions SerializationSettings()
     {
         var settings = Serialization.CreateSerializerSettings();
-        settings.Converters.Add(new PolymorphicConverter());
         settings.TypeInfoResolver = new DefaultJsonTypeInfoResolver
         {
             Modifiers =