diff --git a/Examples/domain_01/domain_01.csproj b/Examples/domain_01/domain_01.csproj index 1e775209..e8ad20a8 100644 --- a/Examples/domain_01/domain_01.csproj +++ b/Examples/domain_01/domain_01.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 + netcoreapp2.1 InProcess diff --git a/Examples/efcore_to_freesql/efcore_to_freesql.csproj b/Examples/efcore_to_freesql/efcore_to_freesql.csproj index fc27cbf1..4516a3f9 100644 --- a/Examples/efcore_to_freesql/efcore_to_freesql.csproj +++ b/Examples/efcore_to_freesql/efcore_to_freesql.csproj @@ -1,13 +1,13 @@  - netcoreapp2.2 + netcoreapp2.1 InProcess - + diff --git a/FreeSql.Repository/FreeSql.Repository.csproj b/FreeSql.Repository/FreeSql.Repository.csproj index 3de04a42..357151fc 100644 --- a/FreeSql.Repository/FreeSql.Repository.csproj +++ b/FreeSql.Repository/FreeSql.Repository.csproj @@ -2,7 +2,7 @@ netstandard2.0 - 0.3.27 + 0.4.9 YeXiangQin FreeSql Implementation of General Repository, Support MySql/SqlServer/PostgreSQL/Oracle/Sqlite, and read/write separation、and split table. https://github.com/2881099/FreeSql/wiki/Repository diff --git a/FreeSql.Tests/MySql/MySqlExpression/StringTest.cs b/FreeSql.Tests/MySql/MySqlExpression/StringTest.cs index 32bf386f..30bbb7a6 100644 --- a/FreeSql.Tests/MySql/MySqlExpression/StringTest.cs +++ b/FreeSql.Tests/MySql/MySqlExpression/StringTest.cs @@ -34,6 +34,7 @@ namespace FreeSql.Tests.MySqlExpression { } class TestEqualsGuid { public Guid id { get; set; } + public bool IsDeleted { get; set; } } [Fact] @@ -41,6 +42,7 @@ namespace FreeSql.Tests.MySqlExpression { var list = new List(); list.Add(select.Where(a => a.Title.Equals("aaa")).ToList()); list.Add(g.sqlite.Select().Where(a => a.id.Equals(Guid.Empty)).ToList()); + list.Add(g.sqlite.Select().Where(a => a.IsDeleted.Equals(false)).ToList()); } [Fact] diff --git a/FreeSql/FreeSql.csproj b/FreeSql/FreeSql.csproj index 18f277ba..ac4e0642 100644 --- a/FreeSql/FreeSql.csproj +++ b/FreeSql/FreeSql.csproj @@ -2,7 +2,7 @@ netstandard2.0 - 0.4.5 + 0.4.9 true YeXiangQin FreeSql is the most convenient ORM in dotnet. It supports Mysql, Postgresql, SqlServer, Oracle and Sqlite. diff --git a/FreeSql/Internal/CommonExpression.cs b/FreeSql/Internal/CommonExpression.cs index 040dd439..56efbddf 100644 --- a/FreeSql/Internal/CommonExpression.cs +++ b/FreeSql/Internal/CommonExpression.cs @@ -306,6 +306,14 @@ namespace FreeSql.Internal { return $"case when {ExpressionLambdaToSql(condExp.Test, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style)} then {ExpressionLambdaToSql(condExp.IfTrue, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style)} else {ExpressionLambdaToSql(condExp.IfFalse, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style)} end"; case ExpressionType.Call: var exp3 = exp as MethodCallExpression; + var callType = exp3.Object?.Type ?? exp3.Method.DeclaringType; + switch (callType.FullName) { + case "System.String": return ExpressionLambdaToSqlCallString(exp3, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style); + case "System.Math": return ExpressionLambdaToSqlCallMath(exp3, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style); + case "System.DateTime": return ExpressionLambdaToSqlCallDateTime(exp3, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style); + case "System.TimeSpan": return ExpressionLambdaToSqlCallTimeSpan(exp3, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style); + case "System.Convert": return ExpressionLambdaToSqlCallConvert(exp3, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style); + } if (exp3.Method.Name == "Equals" && exp3.Object != null && exp3.Arguments.Count > 0) { var tmptryoper = "="; var tmpleft = ExpressionLambdaToSql(exp3.Object, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style); @@ -318,14 +326,6 @@ namespace FreeSql.Internal { if (tmpright == "NULL") tmptryoper = " IS "; return $"{tmpleft}{tmptryoper}{tmpright}"; } - var callType = exp3.Object?.Type ?? exp3.Method.DeclaringType; - switch (callType.FullName) { - case "System.String": return ExpressionLambdaToSqlCallString(exp3, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style); - case "System.Math": return ExpressionLambdaToSqlCallMath(exp3, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style); - case "System.DateTime": return ExpressionLambdaToSqlCallDateTime(exp3, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style); - case "System.TimeSpan": return ExpressionLambdaToSqlCallTimeSpan(exp3, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style); - case "System.Convert": return ExpressionLambdaToSqlCallConvert(exp3, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style); - } if (callType.FullName.StartsWith("FreeSql.ISelectGroupingAggregate`")) { switch (exp3.Method.Name) { case "Count": return "count(1)";