- 修复 Lambda .Contains 通配符解析为非 Like 问题;

This commit is contained in:
2881099
2025-05-29 20:49:05 +08:00
parent a2b1d5525b
commit ac1127ad60
25 changed files with 41 additions and 27 deletions

View File

@@ -288,7 +288,7 @@ namespace FreeSql.Dameng
var leftLike = exp.Object.NodeType == ExpressionType.MemberAccess ? left : $"({left})";
var args0Value = getExp(exp.Arguments[0]);
if (args0Value == "NULL") return $"{leftLike} IS NULL";
if (args0Value.Contains("%"))
if (new[] { '%', '_', '[', ']', '*' }.Any(wildcard => args0Value.Contains(wildcard)))
{
if (exp.Method.Name == "StartsWith") return $"instr({left}, {args0Value}, 1, 1) = 1";
if (exp.Method.Name == "EndsWith") return $"instr({left}, {args0Value}, 1, 1) = length({left})-length({args0Value})+1";