Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

551 B
Raw Blame
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);
    }
}