diff --git a/Src/Asp.Net/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs index 6a17c2c9d..a15c56f0a 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/DeleteProvider/DeleteableProvider.cs @@ -184,8 +184,12 @@ namespace SqlSugar { var expResult = DeleteBuilder.GetExpressionValue(expression, ResolveExpressType.WhereSingle); var whereString = expResult.GetResultString(); - if (expression.ToString().Contains("Subqueryable()")){ - whereString = whereString.Replace(this.SqlBuilder.GetTranslationColumnName(expression.Parameters.First().Name) + ".",this.SqlBuilder.GetTranslationTableName(this.EntityInfo.DbTableName) + "."); + if (expression.ToString().Contains("Subqueryable()")) { + whereString = whereString.Replace(this.SqlBuilder.GetTranslationColumnName(expression.Parameters.First().Name) + ".", this.SqlBuilder.GetTranslationTableName(this.EntityInfo.DbTableName) + "."); + } + else if (expResult.IsNavicate) + { + whereString = whereString.Replace(expression.Parameters.First().Name + ".", this.SqlBuilder.GetTranslationTableName(this.EntityInfo.DbTableName) + "."); } DeleteBuilder.WhereInfos.Add(whereString); return this; diff --git a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/DeleteBuilder.cs b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/DeleteBuilder.cs index 724edf92c..c8e0f5114 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/DeleteBuilder.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/DeleteBuilder.cs @@ -154,6 +154,7 @@ namespace SqlSugar { resolveExpress.PgSqlIsAutoToLower = true; } + resolveExpress.SugarContext = new ExpressionOutParameter() { Context = this.Context }; resolveExpress.MappingColumns = Context.MappingColumns; resolveExpress.MappingTables = Context.MappingTables; resolveExpress.IgnoreComumnList = Context.IgnoreColumns; diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/ExpressionResult.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/ExpressionResult.cs index 316e71587..d7577b4b6 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/ExpressionResult.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/Common/ExpressionResult.cs @@ -9,6 +9,7 @@ namespace SqlSugar { public bool IsLockCurrentParameter { get; set; } public bool IsUpper { get; set; } + public bool IsNavicate { get; set; } private ExpressionParameter _CurrentParameter; public ExpressionParameter CurrentParameter { diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs index 8d331ef00..373b643fe 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs @@ -682,7 +682,16 @@ namespace SqlSugar } return result; ; } - + protected void SetNavigateResult() + { + if (this.Context != null) + { + if (this.Context.Result != null) + { + this.Context.Result.IsNavicate = true; + } + } + } private string GetAsName(Expression item, object shortName, PropertyInfo property) { string asName; diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs index f0a917f32..50a72b0a8 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs @@ -248,6 +248,7 @@ namespace SqlSugar if (nav.IsNavgate(express)) { var sql = nav.GetSql(); + SetNavigateResult(); this.Context.SingleTableNameSubqueryShortName = nav.ShorName; base.AppendValue(parameter, isLeft, sql); return; @@ -257,6 +258,7 @@ namespace SqlSugar if (nav2.IsNavgate(express)) { var sql = nav2.GetSql(); + SetNavigateResult(); this.Context.SingleTableNameSubqueryShortName = nav2.shorName; base.AppendValue(parameter, isLeft, sql); return; @@ -293,6 +295,8 @@ namespace SqlSugar } } + + private void NativeExtensionMethod(ExpressionParameter parameter, MethodCallExpression express, bool? isLeft, string name, List appendArgs = null) { var method = express.Method;