-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue with ToLowerInvariant() method in LiteDBRepository.cs Setup…
… failed: Method ToLowerInvariant() in String are not supported when convert to BsonExpression #479
- Loading branch information
support
committed
Apr 7, 2024
1 parent
a864d1c
commit e0c1d67
Showing
3 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System.Linq.Expressions; | ||
|
||
namespace Grand.Data.LiteDb; | ||
public class ToLowerInvariantVisitor : ExpressionVisitor | ||
{ | ||
protected override Expression VisitMethodCall(MethodCallExpression node) | ||
{ | ||
if (node.Method == typeof(string).GetMethod("ToLowerInvariant", Type.EmptyTypes)) | ||
{ | ||
var invariantMethod = typeof(string).GetMethod("ToLower", Type.EmptyTypes); | ||
if (invariantMethod != null) | ||
{ | ||
return Expression.Call(node.Object, invariantMethod); | ||
} | ||
|
||
} | ||
return base.VisitMethodCall(node); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters