소스 검색

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 년 전
부모
커밋
6246a6a526
2개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      InABox.Core/AutoEntity/AutoEntityUnionGenerator.cs
  2. 2 0
      inabox.database.sqlite/SQLiteProvider.cs

+ 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() ?? "";
 
         }