Browse Source

Added ability for Query Filters to refer to other columns instead of just constant values by passsing in an IColumn parameter

Frank van den Bos 2 years ago
parent
commit
6246a6a526

+ 1 - 1
InABox.Core/AutoEntity/AutoEntityUnionGenerator.cs

@@ -50,7 +50,7 @@ namespace InABox.Core
             Filter = filter;
         }
         
-        public AutoEntityUnionTable<TInterface, TEntity> AddConstant<TType>(TType constant, Expression<Func<TInterface, object?>> mapping)
+        public AutoEntityUnionTable<TInterface, TEntity> AddConstant<TType>(Expression<Func<TInterface, object?>> mapping, TType constant)
         {
             _constants.Add(new AutoEntityUnionConstant(constant, new Column<TInterface>(mapping)));
             return this;

+ 2 - 0
inabox.database.sqlite/SQLiteProvider.cs

@@ -1333,6 +1333,8 @@ namespace InABox.Database.SQLite
                 return string.Format("\'" + "{0}" + "\'", value.ToString()?.Replace("\'", "\'\'"));
             if (value is string[])
                 return string.Format("hex({0})", BitConverter.ToString(Encoding.ASCII.GetBytes(value.ToString() ?? "")).Replace("-", string.Empty));
+            if (value is IColumn col)
+                return $"[{col.Property}]";
             return value.ToString() ?? "";
 
         }