@@ -100,17 +100,12 @@ public override Expression VisitMatchText(MatchTextExpression expression, QueryC
100100
101101 Expression text = Visit ( expression . TextValue , context ) ;
102102
103- if ( expression . MatchKind == TextMatchKind . StartsWith )
103+ return expression . MatchKind switch
104104 {
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+ } ;
114109 }
115110
116111 public override Expression VisitAny ( AnyExpression expression , QueryClauseBuilderContext context )
@@ -137,17 +132,12 @@ public override Expression VisitLogical(LogicalExpression expression, QueryClaus
137132 {
138133 var termQueue = new Queue < Expression > ( expression . Terms . Select ( filter => Visit ( filter , context ) ) ) ;
139134
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
146136 {
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+ } ;
151141 }
152142
153143 private static BinaryExpression Compose ( Queue < Expression > argumentQueue , Func < Expression , Expression , BinaryExpression > applyOperator )
0 commit comments