From 099f96679652eb2c4d139f25488ddbd742e8d408 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Tue, 4 Jul 2017 00:50:37 +0800 Subject: [PATCH] Add Where(String) override --- .../QueryableProvider/QueryableProvider.cs | 100 +++++++++++++++++- Src/Asp.Net/SqlSugar/Interface/IQueryable.cs | 23 +++- 2 files changed, 117 insertions(+), 6 deletions(-) diff --git a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs index 8c2627d48..5b04a6de0 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs @@ -665,7 +665,7 @@ namespace SqlSugar _Where(expression); return this; } - public ISugarQueryable WhereIF(bool isWhere, Expression> expression) + public new ISugarQueryable WhereIF(bool isWhere, Expression> expression) { if (isWhere) _Where(expression); @@ -677,6 +677,18 @@ namespace SqlSugar _Where(expression); return this; } + public new ISugarQueryable Where(string whereString, object whereObj) + { + Where(whereString, whereObj); + return this; + } + + public new ISugarQueryable WhereIF(bool isWhere, string whereString, object whereObj) + { + if (!isWhere) return this; + this.Where(whereString, whereObj); + return this; + } #endregion #region Select @@ -802,12 +814,25 @@ namespace SqlSugar return this; } - public ISugarQueryable WhereIF(bool isWhere, Expression> expression) + public new ISugarQueryable WhereIF(bool isWhere, Expression> expression) { if (isWhere) _Where(expression); return this; } + + public new ISugarQueryable Where(string whereString, object whereObj) + { + Where(whereString, whereObj); + return this; + } + + public new ISugarQueryable WhereIF(bool isWhere, string whereString, object whereObj) + { + if (!isWhere) return this; + this.Where(whereString, whereObj); + return this; + } #endregion } @@ -837,7 +862,7 @@ namespace SqlSugar return this; } - public ISugarQueryable WhereIF(bool isWhere, Expression> expression) + public new ISugarQueryable WhereIF(bool isWhere, Expression> expression) { if (isWhere) _Where(expression); @@ -864,6 +889,19 @@ namespace SqlSugar _Where(expression); return this; } + + public new ISugarQueryable Where(string whereString, object whereObj) + { + Where(whereString, whereObj); + return this; + } + + public new ISugarQueryable WhereIF(bool isWhere, string whereString, object whereObj) + { + if (!isWhere) return this; + this.Where(whereString, whereObj); + return this; + } #endregion #region Select @@ -958,7 +996,7 @@ namespace SqlSugar return this; } - public ISugarQueryable WhereIF(bool isWhere, Expression> expression) + public new ISugarQueryable WhereIF(bool isWhere, Expression> expression) { if (isWhere) _Where(expression); @@ -992,6 +1030,19 @@ namespace SqlSugar _Where(expression); return this; } + + public new ISugarQueryable Where(string whereString, object whereObj) + { + Where(whereString, whereObj); + return this; + } + + public new ISugarQueryable WhereIF(bool isWhere, string whereString, object whereObj) + { + if (!isWhere) return this; + this.Where(whereString, whereObj); + return this; + } #endregion #region Select @@ -1105,7 +1156,7 @@ namespace SqlSugar return this; } - public ISugarQueryable WhereIF(bool isWhere, Expression> expression) + public new ISugarQueryable WhereIF(bool isWhere, Expression> expression) { if (isWhere) _Where(expression); @@ -1146,6 +1197,19 @@ namespace SqlSugar _Where(expression); return this; } + + public new ISugarQueryable Where(string whereString, object whereObj) + { + Where(whereString, whereObj); + return this; + } + + public new ISugarQueryable WhereIF(bool isWhere, string whereString, object whereObj) + { + if (!isWhere) return this; + this.Where(whereString, whereObj); + return this; + } #endregion #region Select @@ -1326,6 +1390,19 @@ namespace SqlSugar _Where(expression); return this; } + + public new ISugarQueryable Where(string whereString, object whereObj) + { + Where(whereString, whereObj); + return this; + } + + public new ISugarQueryable WhereIF(bool isWhere, string whereString, object whereObj) + { + if (!isWhere) return this; + this.Where(whereString, whereObj); + return this; + } #endregion #region Select @@ -1533,6 +1610,19 @@ namespace SqlSugar _Where(expression); return this; } + + public new ISugarQueryable Where(string whereString, object whereObj) + { + Where(whereString, whereObj); + return this; + } + + public new ISugarQueryable WhereIF(bool isWhere, string whereString, object whereObj) + { + if (!isWhere) return this; + this.Where(whereString, whereObj); + return this; + } #endregion #region Select diff --git a/Src/Asp.Net/SqlSugar/Interface/IQueryable.cs b/Src/Asp.Net/SqlSugar/Interface/IQueryable.cs index 23a7c3e52..5afc40d3c 100644 --- a/Src/Asp.Net/SqlSugar/Interface/IQueryable.cs +++ b/Src/Asp.Net/SqlSugar/Interface/IQueryable.cs @@ -99,6 +99,9 @@ namespace SqlSugar new ISugarQueryable WhereIF(bool isWhere,Expression> expression); ISugarQueryable WhereIF(bool isWhere, Expression> expression); + + new ISugarQueryable Where(string whereString, object whereObj = null); + new ISugarQueryable WhereIF(bool isWhere, string whereString, object whereObj = null); #endregion #region Select @@ -125,6 +128,9 @@ namespace SqlSugar new ISugarQueryable WhereIF(bool isWhere, Expression> expression); ISugarQueryable WhereIF(bool isWhere, Expression> expression); ISugarQueryable WhereIF(bool isWhere, Expression> expression); + + new ISugarQueryable Where(string whereString, object whereObj = null); + new ISugarQueryable WhereIF(bool isWhere, string whereString, object whereObj = null); #endregion #region Select @@ -156,6 +162,9 @@ namespace SqlSugar ISugarQueryable WhereIF(bool isWhere, Expression> expression); ISugarQueryable WhereIF(bool isWhere, Expression> expression); ISugarQueryable WhereIF(bool isWhere, Expression> expression); + + new ISugarQueryable Where(string whereString, object whereObj = null); + new ISugarQueryable WhereIF(bool isWhere, string whereString, object whereObj = null); #endregion #region Select @@ -193,6 +202,9 @@ namespace SqlSugar ISugarQueryable WhereIF(bool isWhere, Expression> expression); ISugarQueryable WhereIF(bool isWhere, Expression> expression); ISugarQueryable WhereIF(bool isWhere, Expression> expression); + + new ISugarQueryable Where(string whereString, object whereObj = null); + new ISugarQueryable WhereIF(bool isWhere, string whereString, object whereObj = null); #endregion #region Select @@ -234,6 +246,9 @@ namespace SqlSugar ISugarQueryable WhereIF(bool isWhere, Expression> expression); ISugarQueryable WhereIF(bool isWhere, Expression> expression); ISugarQueryable WhereIF(bool isWhere, Expression> expression); + + new ISugarQueryable Where(string whereString, object whereObj = null); + new ISugarQueryable WhereIF(bool isWhere, string whereString, object whereObj = null); #endregion #region Select @@ -273,13 +288,16 @@ namespace SqlSugar ISugarQueryable Where(Expression> expression); ISugarQueryable Where(Expression> expression); - ISugarQueryable WhereIF(bool isWhere, Expression> expression); + new ISugarQueryable WhereIF(bool isWhere, Expression> expression); ISugarQueryable WhereIF(bool isWhere, Expression> expression); ISugarQueryable WhereIF(bool isWhere, Expression> expression); ISugarQueryable WhereIF(bool isWhere, Expression> expression); ISugarQueryable WhereIF(bool isWhere, Expression> expression); ISugarQueryable WhereIF(bool isWhere, Expression> expression); ISugarQueryable WhereIF(bool isWhere, Expression> expression); + + new ISugarQueryable Where(string whereString, object whereObj = null); + new ISugarQueryable WhereIF(bool isWhere, string whereString, object whereObj = null); #endregion #region Select @@ -331,6 +349,9 @@ namespace SqlSugar ISugarQueryable WhereIF(bool isWhere, Expression> expression); ISugarQueryable WhereIF(bool isWhere, Expression> expression); ISugarQueryable WhereIF(bool isWhere, Expression> expression); + + new ISugarQueryable Where(string whereString, object whereObj = null); + new ISugarQueryable WhereIF(bool isWhere, string whereString, object whereObj = null); #endregion #region Select