diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs index 9ac44dbf4..bdb3da9c6 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs @@ -771,10 +771,14 @@ namespace SqlSugar type = DbType.Oracle; else if (this.Context is PostgreSQLExpressionContext) type = DbType.PostgreSQL; - else if (this.Context.GetType().Name.StartsWith("MySql")) + else if (this.Context.GetType().Name.StartsWith("MySql")) { type = DbType.MySql; } + else + { + type = GetType(this.Context.GetType().Name); + } return this.Context.SqlFuncServices.First(it => it.UniqueMethodName == name).MethodValue(model, type, this.Context); } else @@ -1021,6 +1025,20 @@ namespace SqlSugar return null; } + private DbType GetType(string name) + { + DbType result = DbType.SqlServer; + foreach (var item in UtilMethods.EnumToDictionary()) + { + if (name.StartsWith(item.Value.ToString())) + { + result = item.Value; + break; + } + } + return result; + } + private bool IsContainsArray(MethodCallExpression express, string methodName, bool isValidNativeMethod) { return !isValidNativeMethod && express.Method.DeclaringType.Namespace.IsIn("System.Linq", "System.Collections.Generic") && methodName == "Contains";