mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 09:15:27 +08:00 
			
		
		
		
	修复 ISelect2 以上 WhereIf 条件作用反了 bug
This commit is contained in:
		@@ -2,7 +2,7 @@
 | 
			
		||||
 | 
			
		||||
	<PropertyGroup>
 | 
			
		||||
		<TargetFramework>netstandard2.0</TargetFramework>
 | 
			
		||||
		<Version>0.5.1.2</Version>
 | 
			
		||||
		<Version>0.5.1.3</Version>
 | 
			
		||||
		<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
 | 
			
		||||
		<Authors>YeXiangQin</Authors>
 | 
			
		||||
		<Description>FreeSql is the most convenient ORM in dotnet. It supports Mysql, Postgresql, SqlServer, Oracle and Sqlite.</Description>
 | 
			
		||||
 
 | 
			
		||||
@@ -147,8 +147,7 @@ namespace FreeSql.Internal.CommonProvider {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>.WhereIf(bool condition, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, bool>> exp) {
 | 
			
		||||
			if (condition) return this.Where(null);
 | 
			
		||||
			if (exp == null) return this.Where(null);
 | 
			
		||||
			if (condition == false || exp == null) return this.Where(null);
 | 
			
		||||
			for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a];
 | 
			
		||||
			return condition ? this.Where(_commonExpression.ExpressionWhereLambda(_tables, exp?.Body, null)) : this;
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -221,8 +221,7 @@ namespace FreeSql.Internal.CommonProvider {
 | 
			
		||||
		public ISelect<T1> WhereDynamic(object dywhere) => this.Where(_commonUtils.WhereObject(_tables.First().Table, $"{_tables.First().Alias}.", dywhere));
 | 
			
		||||
 | 
			
		||||
		public ISelect<T1> WhereIf(bool condition, Expression<Func<T1, bool>> exp) {
 | 
			
		||||
			if (condition == false) return this;
 | 
			
		||||
			if (exp == null) return this;
 | 
			
		||||
			if (condition == false || exp == null) return this;
 | 
			
		||||
			_tables[0].Parameter = exp.Parameters[0];
 | 
			
		||||
			return this.InternalWhere(exp?.Body);
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -131,10 +131,9 @@ namespace FreeSql.Internal.CommonProvider {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		ISelect<T1, T2> ISelect<T1, T2>.WhereIf(bool condition, Expression<Func<T1, T2, bool>> exp) {
 | 
			
		||||
			if (condition) return this.Where(null);
 | 
			
		||||
			if (exp == null) return this.Where(null);
 | 
			
		||||
			if (condition == false || exp == null) return this;
 | 
			
		||||
			for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a];
 | 
			
		||||
			return condition ? this.Where(_commonExpression.ExpressionWhereLambda(_tables, exp?.Body, null)) : this;
 | 
			
		||||
			return this.Where(_commonExpression.ExpressionWhereLambda(_tables, exp?.Body, null));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		bool ISelect<T1, T2>.Any(Expression<Func<T1, T2, bool>> exp) {
 | 
			
		||||
 
 | 
			
		||||
@@ -133,10 +133,9 @@ namespace FreeSql.Internal.CommonProvider {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		ISelect<T1, T2, T3> ISelect<T1, T2, T3>.WhereIf(bool condition, Expression<Func<T1, T2, T3, bool>> exp) {
 | 
			
		||||
			if (condition) return this.Where(null);
 | 
			
		||||
			if (exp == null) return this.Where(null);
 | 
			
		||||
			if (condition == false || exp == null) return this;
 | 
			
		||||
			for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a];
 | 
			
		||||
			return condition ? this.Where(_commonExpression.ExpressionWhereLambda(_tables, exp?.Body, null)) : this;
 | 
			
		||||
			return this.Where(_commonExpression.ExpressionWhereLambda(_tables, exp?.Body, null));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		bool ISelect<T1, T2, T3>.Any(Expression<Func<T1, T2, T3, bool>> exp) {
 | 
			
		||||
 
 | 
			
		||||
@@ -135,10 +135,9 @@ namespace FreeSql.Internal.CommonProvider {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		ISelect<T1, T2, T3, T4> ISelect<T1, T2, T3, T4>.WhereIf(bool condition, Expression<Func<T1, T2, T3, T4, bool>> exp) {
 | 
			
		||||
			if (condition) return this.Where(null);
 | 
			
		||||
			if (exp == null) return this.Where(null);
 | 
			
		||||
			if (condition == false || exp == null) return this;
 | 
			
		||||
			for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a];
 | 
			
		||||
			return condition ? this.Where(_commonExpression.ExpressionWhereLambda(_tables, exp?.Body, null)) : this;
 | 
			
		||||
			return this.Where(_commonExpression.ExpressionWhereLambda(_tables, exp?.Body, null));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		bool ISelect<T1, T2, T3, T4>.Any(Expression<Func<T1, T2, T3, T4, bool>> exp) {
 | 
			
		||||
 
 | 
			
		||||
@@ -137,10 +137,9 @@ namespace FreeSql.Internal.CommonProvider {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		ISelect<T1, T2, T3, T4, T5> ISelect<T1, T2, T3, T4, T5>.WhereIf(bool condition, Expression<Func<T1, T2, T3, T4, T5, bool>> exp) {
 | 
			
		||||
			if (condition) return this.Where(null);
 | 
			
		||||
			if (exp == null) return this.Where(null);
 | 
			
		||||
			if (condition == false || exp == null) return this;
 | 
			
		||||
			for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a];
 | 
			
		||||
			return condition ? this.Where(_commonExpression.ExpressionWhereLambda(_tables, exp?.Body, null)) : this;
 | 
			
		||||
			return this.Where(_commonExpression.ExpressionWhereLambda(_tables, exp?.Body, null));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		bool ISelect<T1, T2, T3, T4, T5>.Any(Expression<Func<T1, T2, T3, T4, T5, bool>> exp) {
 | 
			
		||||
 
 | 
			
		||||
@@ -139,10 +139,9 @@ namespace FreeSql.Internal.CommonProvider {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		ISelect<T1, T2, T3, T4, T5, T6> ISelect<T1, T2, T3, T4, T5, T6>.WhereIf(bool condition, Expression<Func<T1, T2, T3, T4, T5, T6, bool>> exp) {
 | 
			
		||||
			if (condition) return this.Where(null);
 | 
			
		||||
			if (exp == null) return this.Where(null);
 | 
			
		||||
			if (condition == false || exp == null) return this;
 | 
			
		||||
			for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a];
 | 
			
		||||
			return condition ? this.Where(_commonExpression.ExpressionWhereLambda(_tables, exp?.Body, null)) : this;
 | 
			
		||||
			return this.Where(_commonExpression.ExpressionWhereLambda(_tables, exp?.Body, null));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		bool ISelect<T1, T2, T3, T4, T5, T6>.Any(Expression<Func<T1, T2, T3, T4, T5, T6, bool>> exp) {
 | 
			
		||||
 
 | 
			
		||||
@@ -141,10 +141,9 @@ namespace FreeSql.Internal.CommonProvider {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		ISelect<T1, T2, T3, T4, T5, T6, T7> ISelect<T1, T2, T3, T4, T5, T6, T7>.WhereIf(bool condition, Expression<Func<T1, T2, T3, T4, T5, T6, T7, bool>> exp) {
 | 
			
		||||
			if (condition) return this.Where(null);
 | 
			
		||||
			if (exp == null) return this.Where(null);
 | 
			
		||||
			if (condition == false || exp == null) return this;
 | 
			
		||||
			for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a];
 | 
			
		||||
			return condition ? this.Where(_commonExpression.ExpressionWhereLambda(_tables, exp?.Body, null)) : this;
 | 
			
		||||
			return this.Where(_commonExpression.ExpressionWhereLambda(_tables, exp?.Body, null));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		bool ISelect<T1, T2, T3, T4, T5, T6, T7>.Any(Expression<Func<T1, T2, T3, T4, T5, T6, T7, bool>> exp) {
 | 
			
		||||
 
 | 
			
		||||
@@ -143,10 +143,9 @@ namespace FreeSql.Internal.CommonProvider {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		ISelect<T1, T2, T3, T4, T5, T6, T7, T8> ISelect<T1, T2, T3, T4, T5, T6, T7, T8>.WhereIf(bool condition, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, bool>> exp) {
 | 
			
		||||
			if (condition) return this.Where(null);
 | 
			
		||||
			if (exp == null) return this.Where(null);
 | 
			
		||||
			if (condition == false || exp == null) return this;
 | 
			
		||||
			for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a];
 | 
			
		||||
			return condition ? this.Where(_commonExpression.ExpressionWhereLambda(_tables, exp?.Body, null)) : this;
 | 
			
		||||
			return this.Where(_commonExpression.ExpressionWhereLambda(_tables, exp?.Body, null));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		bool ISelect<T1, T2, T3, T4, T5, T6, T7, T8>.Any(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, bool>> exp) {
 | 
			
		||||
 
 | 
			
		||||
@@ -145,10 +145,9 @@ namespace FreeSql.Internal.CommonProvider {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9> ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>.WhereIf(bool condition, Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, bool>> exp) {
 | 
			
		||||
			if (condition) return this.Where(null);
 | 
			
		||||
			if (exp == null) return this.Where(null);
 | 
			
		||||
			if (condition == false || exp == null) return this;
 | 
			
		||||
			for (var a = 0; a < exp.Parameters.Count; a++) _tables[a].Parameter = exp.Parameters[a];
 | 
			
		||||
			return condition ? this.Where(_commonExpression.ExpressionWhereLambda(_tables, exp?.Body, null)) : this;
 | 
			
		||||
			return this.Where(_commonExpression.ExpressionWhereLambda(_tables, exp?.Body, null));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		bool ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9>.Any(Expression<Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, bool>> exp) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user