11using System ;
2+ using System . Collections ;
23using System . Collections . Generic ;
34using System . Linq ;
45using System . Linq . Expressions ;
@@ -146,12 +147,12 @@ public Table<TModel> Filter<TCriterion>(string columnName, Operator op, TCriteri
146147 case float floatCriterion :
147148 _filters . Add ( new QueryFilter ( columnName , op , floatCriterion ) ) ;
148149 return this ;
149- case List < object > listCriteria :
150- _filters . Add ( new QueryFilter ( columnName , op , listCriteria ) ) ;
151- return this ;
152- case Dictionary < string , object > dictCriteria :
150+ case IDictionary dictCriteria :
153151 _filters . Add ( new QueryFilter ( columnName , op , dictCriteria ) ) ;
154152 return this ;
153+ case IList listCriteria :
154+ _filters . Add ( new QueryFilter ( columnName , op , listCriteria ) ) ;
155+ return this ;
155156 case IntRange rangeCriteria :
156157 _filters . Add ( new QueryFilter ( columnName , op , rangeCriteria ) ) ;
157158 return this ;
@@ -810,18 +811,19 @@ internal KeyValuePair<string, string> PrepareFilter(QueryFilter filter)
810811
811812 break ;
812813 case Operator . In :
813- if ( filter . Criteria is List < object > inCriteria && filter . Property != null )
814+ if ( filter is { Criteria : IList inCriteria , Property : not null } )
814815 {
815816 foreach ( var item in inCriteria )
816817 strBuilder . Append ( $ "\" { item } \" ,") ;
817818
818819 return new KeyValuePair < string , string > ( filter . Property ,
819820 $ "{ asAttribute . Mapping } .({ strBuilder . ToString ( ) . Trim ( ',' ) } )") ;
820821 }
821- else if ( filter . Criteria is Dictionary < string , object > dictCriteria && filter . Property != null )
822+
823+ if ( filter is { Criteria : IDictionary inDictCriteria , Property : not null } )
822824 {
823825 return new KeyValuePair < string , string > ( filter . Property ,
824- $ "{ asAttribute . Mapping } .{ JsonConvert . SerializeObject ( dictCriteria ) } ") ;
826+ $ "{ asAttribute . Mapping } .{ JsonConvert . SerializeObject ( inDictCriteria ) } ") ;
825827 }
826828
827829 break ;
@@ -830,15 +832,15 @@ internal KeyValuePair<string, string> PrepareFilter(QueryFilter filter)
830832 case Operator . Overlap :
831833 switch ( filter . Criteria )
832834 {
833- case List < object > listCriteria when filter . Property != null :
835+ case IList listCriteria when filter . Property != null :
834836 {
835837 foreach ( var item in listCriteria )
836838 strBuilder . Append ( $ "{ item } ,") ;
837839
838840 return new KeyValuePair < string , string > ( filter . Property ,
839841 $ "{ asAttribute . Mapping } .{{{strBuilder.ToString().Trim(',')}}}") ;
840842 }
841- case Dictionary < string , object > dictCriteria when filter . Property != null :
843+ case IDictionary dictCriteria when filter . Property != null :
842844 return new KeyValuePair < string , string > ( filter . Property ,
843845 $ "{ asAttribute . Mapping } .{ JsonConvert . SerializeObject ( dictCriteria ) } ") ;
844846 case IntRange rangeCriteria when filter . Property != null :
@@ -852,7 +854,7 @@ internal KeyValuePair<string, string> PrepareFilter(QueryFilter filter)
852854 case Operator . NotRightOf :
853855 case Operator . NotLeftOf :
854856 case Operator . Adjacent :
855- if ( filter . Criteria is IntRange rangeCriterion && filter . Property != null )
857+ if ( filter is { Criteria : IntRange rangeCriterion , Property : not null } )
856858 {
857859 return new KeyValuePair < string , string > ( filter . Property ,
858860 $ "{ asAttribute . Mapping } .{ rangeCriterion . ToPostgresString ( ) } ") ;
@@ -863,7 +865,7 @@ internal KeyValuePair<string, string> PrepareFilter(QueryFilter filter)
863865 case Operator . PHFTS :
864866 case Operator . PLFTS :
865867 case Operator . WFTS :
866- if ( filter . Criteria is FullTextSearchConfig searchConfig && filter . Property != null )
868+ if ( filter is { Criteria : FullTextSearchConfig searchConfig , Property : not null } )
867869 {
868870 return new KeyValuePair < string , string > ( filter . Property ,
869871 $ "{ asAttribute . Mapping } ({ searchConfig . Config } ).{ searchConfig . QueryText } ") ;
0 commit comments