Compatible with.NET 9.2 preview

This commit is contained in:
sunkaixuan
2025-02-15 14:53:00 +08:00
parent 41895680b0
commit 20d6d5a56d
2 changed files with 28 additions and 0 deletions

View File

@@ -282,6 +282,10 @@ namespace SqlSugar
{
expItem = (item as UnaryExpression).Operand;
}
else if (item is MethodCallExpression callExpression&& callExpression.Method.Name== "op_Implicit")
{
expItem = callExpression.Arguments[0];
}
AppendItem(parameter, name, args, model, expItem);
}
if (appendArgs != null)

View File

@@ -1037,8 +1037,32 @@ namespace SqlSugar
private bool IsContainsArray(MethodCallExpression express, string methodName, bool isValidNativeMethod)
{
if (isMemoryExtensionsContainsArray(express, methodName))
{
return true;
}
return !isValidNativeMethod && express.Method.DeclaringType.Namespace.IsIn("System.Collections", "System.Linq", "System.Collections.Generic") && methodName == "Contains";
}
private bool isMemoryExtensionsContainsArray(MethodCallExpression express, string methodName)
{
var isMemoryExtensionsContainsArray = false;
if (express.Method.DeclaringType.Name == "MemoryExtensions" && methodName == "Contains")
{
if (express.Arguments.Count() == 2)
{
if (express.Arguments.First() is MethodCallExpression callExpression)
{
if (callExpression.Method.Name == "op_Implicit")
{
isMemoryExtensionsContainsArray = true;
}
}
}
}
return isMemoryExtensionsContainsArray;
}
private bool IsSubMethod(MethodCallExpression express, string methodName)
{
return SubTools.SubItemsConst.Any(it => it.Name == methodName) && express.Object != null && (express.Object.Type.Name.StartsWith("Subqueryable`"));