diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/DbMethods/SqlFunc.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/DbMethods/SqlFunc.cs index dfb9d5eec..b8d703467 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/DbMethods/SqlFunc.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/DbMethods/SqlFunc.cs @@ -70,6 +70,16 @@ namespace SqlSugar { throw new NotSupportedException("Can only be used in expressions"); } + + public static int Rank(object orderByField, object partitionBy) + { + throw new NotSupportedException("Can only be used in expressions"); + } + public static int Rank(object orderByField) + { + throw new NotSupportedException("Can only be used in expressions"); + } + public static int RowCount(object countFiledName,object orderByField, object partitionBy) { throw new NotSupportedException("Can only be used in expressions"); diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve_Helper.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve_Helper.cs index af02fa7f8..948ad61fe 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve_Helper.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve_Helper.cs @@ -909,6 +909,8 @@ namespace SqlSugar return this.Context.DbMehtods.Stuff(model); case "RowNumber": return this.Context.DbMehtods.RowNumber(model); + case "Rank": + return this.Context.DbMehtods.RowNumber(model).Replace("row_number() over(", " rank() over("); case "RowCount": return this.Context.DbMehtods.RowCount(model); case "RowSum":