From 04089d57b4146a00a574e513e563dda50d78fb3b Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Wed, 18 May 2022 18:18:23 +0800 Subject: [PATCH] Add Queryable.OrderByDescending --- .../QueryableProvider/QueryableProvider.cs | 51 ++++++++++++++++++- Src/Asp.Net/SqlSugar/Interface/IQueryable.cs | 10 ++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs index 2014407ec..43d153917 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs @@ -755,6 +755,11 @@ namespace SqlSugar this._OrderBy(expression, type); return this; } + public virtual ISugarQueryable OrderByDescending(Expression> expression) + { + this._OrderBy(expression, OrderByType.Desc); + return this; + } public virtual ISugarQueryable GroupBy(Expression> expression) { _GroupBy(expression); @@ -3503,7 +3508,16 @@ namespace SqlSugar _OrderBy(expression, type); return this; } - + public new virtual ISugarQueryable OrderByDescending(Expression> expression) + { + this._OrderBy(expression, OrderByType.Desc); + return this; + } + public virtual ISugarQueryable OrderByDescending(Expression> expression) + { + this._OrderBy(expression, OrderByType.Desc); + return this; + } public new ISugarQueryable OrderBy(Expression> expression, OrderByType type) { _OrderBy(expression, type); @@ -3906,6 +3920,21 @@ namespace SqlSugar #endregion #region Order + public new virtual ISugarQueryable OrderByDescending(Expression> expression) + { + this._OrderBy(expression, OrderByType.Desc); + return this; + } + public virtual ISugarQueryable OrderByDescending(Expression> expression) + { + this._OrderBy(expression, OrderByType.Desc); + return this; + } + public virtual ISugarQueryable OrderByDescending(Expression> expression) + { + this._OrderBy(expression, OrderByType.Desc); + return this; + } public new ISugarQueryable OrderBy(string orderFileds) { base.OrderBy(orderFileds); @@ -4445,6 +4474,26 @@ namespace SqlSugar #endregion #region OrderBy + public new virtual ISugarQueryable OrderByDescending(Expression> expression) + { + this._OrderBy(expression, OrderByType.Desc); + return this; + } + public virtual ISugarQueryable OrderByDescending(Expression> expression) + { + this._OrderBy(expression, OrderByType.Desc); + return this; + } + public virtual ISugarQueryable OrderByDescending(Expression> expression) + { + this._OrderBy(expression, OrderByType.Desc); + return this; + } + public virtual ISugarQueryable OrderByDescending(Expression> expression) + { + this._OrderBy(expression, OrderByType.Desc); + return this; + } public new ISugarQueryable OrderBy(string orderFileds) { base.OrderBy(orderFileds); diff --git a/Src/Asp.Net/SqlSugar/Interface/IQueryable.cs b/Src/Asp.Net/SqlSugar/Interface/IQueryable.cs index 40cfb2f1a..8e51a29af 100644 --- a/Src/Asp.Net/SqlSugar/Interface/IQueryable.cs +++ b/Src/Asp.Net/SqlSugar/Interface/IQueryable.cs @@ -76,6 +76,7 @@ namespace SqlSugar ISugarQueryable OrderBy(string orderFileds); ISugarQueryable OrderBy(Expression> expression, OrderByType type = OrderByType.Asc); + ISugarQueryable OrderByDescending(Expression> expression); ISugarQueryable OrderByIF(bool isOrderBy, string orderFileds); ISugarQueryable OrderByIF(bool isOrderBy, Expression> expression, OrderByType type = OrderByType.Asc); @@ -234,6 +235,8 @@ namespace SqlSugar #endregion #region OrderBy + new ISugarQueryable OrderByDescending(Expression> expression); + ISugarQueryable OrderByDescending(Expression> expression); new ISugarQueryable OrderBy(string orderFileds); new ISugarQueryable OrderBy(Expression> expression, OrderByType type = OrderByType.Asc); ISugarQueryable OrderBy(Expression> expression, OrderByType type = OrderByType.Asc); @@ -331,6 +334,9 @@ namespace SqlSugar #endregion #region OrderBy + new ISugarQueryable OrderByDescending(Expression> expression); + ISugarQueryable OrderByDescending(Expression> expression); + ISugarQueryable OrderByDescending(Expression> expression); new ISugarQueryable OrderBy(string orderFileds); new ISugarQueryable OrderBy(Expression> expression, OrderByType type = OrderByType.Asc); ISugarQueryable OrderBy(Expression> expression, OrderByType type = OrderByType.Asc); @@ -441,6 +447,10 @@ namespace SqlSugar #endregion #region OrderBy + new ISugarQueryable OrderByDescending(Expression> expression); + ISugarQueryable OrderByDescending(Expression> expression); + ISugarQueryable OrderByDescending(Expression> expression); + ISugarQueryable OrderByDescending(Expression> expression); new ISugarQueryable OrderBy(string orderFileds); new ISugarQueryable OrderBy(Expression> expression, OrderByType type = OrderByType.Asc); ISugarQueryable OrderBy(Expression> expression, OrderByType type = OrderByType.Asc);