From 2b0d2a64f6970933b1893332ef7af63f33f72e1e Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Wed, 30 Apr 2025 12:15:21 +0800 Subject: [PATCH] Add Util.EscapeLikeValue --- Src/Asp.NetCore2/SqlSugar/Infrastructure/ContextMethods.cs | 6 ++++++ Src/Asp.NetCore2/SqlSugar/Interface/IContextMethods.cs | 1 + 2 files changed, 7 insertions(+) diff --git a/Src/Asp.NetCore2/SqlSugar/Infrastructure/ContextMethods.cs b/Src/Asp.NetCore2/SqlSugar/Infrastructure/ContextMethods.cs index b8f6ecb95..12bd4917a 100644 --- a/Src/Asp.NetCore2/SqlSugar/Infrastructure/ContextMethods.cs +++ b/Src/Asp.NetCore2/SqlSugar/Infrastructure/ContextMethods.cs @@ -1264,5 +1264,11 @@ namespace SqlSugar } #endregion + #region Other + public string EscapeLikeValue(string value, char wildcard = '%') + { + return UtilMethods.EscapeLikeValue(this.Context, value, wildcard); + } + #endregion } } diff --git a/Src/Asp.NetCore2/SqlSugar/Interface/IContextMethods.cs b/Src/Asp.NetCore2/SqlSugar/Interface/IContextMethods.cs index 1040b16bb..cdb0269fb 100644 --- a/Src/Asp.NetCore2/SqlSugar/Interface/IContextMethods.cs +++ b/Src/Asp.NetCore2/SqlSugar/Interface/IContextMethods.cs @@ -51,5 +51,6 @@ namespace SqlSugar DataTable DictionaryListToDataTable(List> dictionaryList); List ToTree(List list, Expression>> childListExpression, Expression> parentIdExpression, Expression> pkExpression, object rootValue); KeyValuePair ConditionalModelsToSql(List conditionalModels, int beginIndex = 0); + string EscapeLikeValue(string value, char wildcard = '%'); } }