@@ -100,17 +100,12 @@ public override Expression VisitMatchText(MatchTextExpression expression, QueryC
100
100
101
101
Expression text = Visit ( expression . TextValue , context ) ;
102
102
103
- if ( expression . MatchKind == TextMatchKind . StartsWith )
103
+ return expression . MatchKind switch
104
104
{
105
- return Expression . Call ( property , "StartsWith" , null , text ) ;
106
- }
107
-
108
- if ( expression . MatchKind == TextMatchKind . EndsWith )
109
- {
110
- return Expression . Call ( property , "EndsWith" , null , text ) ;
111
- }
112
-
113
- return Expression . Call ( property , "Contains" , null , text ) ;
105
+ TextMatchKind . StartsWith => Expression . Call ( property , "StartsWith" , null , text ) ,
106
+ TextMatchKind . EndsWith => Expression . Call ( property , "EndsWith" , null , text ) ,
107
+ _ => Expression . Call ( property , "Contains" , null , text )
108
+ } ;
114
109
}
115
110
116
111
public override Expression VisitAny ( AnyExpression expression , QueryClauseBuilderContext context )
@@ -137,17 +132,12 @@ public override Expression VisitLogical(LogicalExpression expression, QueryClaus
137
132
{
138
133
var termQueue = new Queue < Expression > ( expression . Terms . Select ( filter => Visit ( filter , context ) ) ) ;
139
134
140
- if ( expression . Operator == LogicalOperator . And )
141
- {
142
- return Compose ( termQueue , Expression . AndAlso ) ;
143
- }
144
-
145
- if ( expression . Operator == LogicalOperator . Or )
135
+ return expression . Operator switch
146
136
{
147
- return Compose ( termQueue , Expression . OrElse ) ;
148
- }
149
-
150
- throw new InvalidOperationException ( $ "Unknown logical operator ' { expression . Operator } '." ) ;
137
+ LogicalOperator . And => Compose ( termQueue , Expression . AndAlso ) ,
138
+ LogicalOperator . Or => Compose ( termQueue , Expression . OrElse ) ,
139
+ _ => throw new InvalidOperationException ( $ "Unknown logical operator ' { expression . Operator } '." )
140
+ } ;
151
141
}
152
142
153
143
private static BinaryExpression Compose ( Queue < Expression > argumentQueue , Func < Expression , Expression , BinaryExpression > applyOperator )
0 commit comments