Skip to content

Commit 52f24f2

Browse files
committed
use GeneratedRegex
1 parent 7644257 commit 52f24f2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/GraphQL.EntityFramework/Where/ExpressionBuilder.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
namespace GraphQL.EntityFramework;
22

3-
public static class ExpressionBuilder<T>
3+
public static partial class ExpressionBuilder<T>
44
{
5-
const string listPropertyPattern = @"\[(.*)\]";
6-
75
/// <summary>
86
/// Build a predicate for a supplied list of where's (Grouped or not)
97
/// </summary>
@@ -104,9 +102,9 @@ static Expression MakePredicateBody(string path, Comparison comparison, string?[
104102
static Expression ProcessList(string path, Comparison comparison, string?[]? values, StringComparison? stringComparison)
105103
{
106104
// Get the path pertaining to individual list items
107-
var listPath = Regex.Match(path, listPropertyPattern).Groups[1].Value;
105+
var listPath = ListPropertyRegex().Match(path).Groups[1].Value;
108106
// Remove the part of the path that leads into list item properties
109-
path = Regex.Replace(path, listPropertyPattern, "");
107+
path = ListPropertyRegex().Replace(path, "");
110108

111109
// Get the property on the current object up to the list member
112110
var property = PropertyCache<T>.GetProperty(path);
@@ -319,4 +317,7 @@ static Expression CombineExpressions(Connector connector, Expression expr1, Expr
319317

320318
static Expression NegateExpression(Expression expression) =>
321319
Expression.Not(expression);
320+
321+
[GeneratedRegex(@"\[(.*)\]")]
322+
private static partial Regex ListPropertyRegex();
322323
}

0 commit comments

Comments
 (0)