diff --git a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/ExpressionContext.cs b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/ExpressionContext.cs index b9d72b446..b80c30198 100644 --- a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/ExpressionContext.cs +++ b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/ExpressionContext.cs @@ -158,6 +158,7 @@ namespace SqlSugar #endregion #region Override methods + public virtual string GetLimit() { return null; } public virtual string GetTranslationTableName(string entityName, bool isMapping = true) { Check.ArgumentNullException(entityName, string.Format(ErrorMessage.ObjNotExist, "Table Name")); diff --git a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs index 5bd0d5961..8025ea004 100644 --- a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs +++ b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubTop.cs @@ -61,9 +61,9 @@ namespace SqlSugar { return (HasWhere?"AND":"WHERE")+ " ROWNUM=1"; } - else if (this.Context is PostgreSQLExpressionContext) + else if (this.Context.GetLimit()!=null) { - return "limit 1"; + return this.Context.GetLimit(); } else {