diff --git a/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarAccessory.cs b/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarAccessory.cs index c5b7bc74a..e6ef7e500 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarAccessory.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarAccessory.cs @@ -272,6 +272,10 @@ namespace SqlSugar result.SqlBuilder.QueryBuilder.EntityType = typeof(T); result.SqlBuilder.QueryBuilder.EntityName = typeof(T).Name; result.SqlBuilder.QueryBuilder.LambdaExpressions = InstanceFactory.GetLambdaExpressions(CurrentConnectionConfig); + if (StaticConfig.CompleteQueryableFunc != null) + { + StaticConfig.CompleteQueryableFunc(result); + } return result; } protected InsertableProvider CreateInsertable(T[] insertObjs) where T : class, new() @@ -288,6 +292,10 @@ namespace SqlSugar sqlBuilder.InsertBuilder.LambdaExpressions = InstanceFactory.GetLambdaExpressions(this.CurrentConnectionConfig); sqlBuilder.Context = result.SqlBuilder.InsertBuilder.Context = this; result.Init(); + if (StaticConfig.CompleteInsertableFunc != null) + { + StaticConfig.CompleteInsertableFunc(result); + } return result; } protected DeleteableProvider CreateDeleteable() where T : class, new() @@ -301,6 +309,10 @@ namespace SqlSugar sqlBuilder.DeleteBuilder.Builder = sqlBuilder; sqlBuilder.DeleteBuilder.LambdaExpressions = InstanceFactory.GetLambdaExpressions(this.CurrentConnectionConfig); sqlBuilder.Context = result.SqlBuilder.DeleteBuilder.Context = this; + if (StaticConfig.CompleteDeleteableFunc != null) + { + StaticConfig.CompleteDeleteableFunc(result); + } return result; } protected UpdateableProvider CreateUpdateable(T[] UpdateObjs) where T : class, new() @@ -317,6 +329,10 @@ namespace SqlSugar sqlBuilder.UpdateBuilder.LambdaExpressions = InstanceFactory.GetLambdaExpressions(this.CurrentConnectionConfig); sqlBuilder.Context = result.SqlBuilder.UpdateBuilder.Context = this; result.Init(); + if (StaticConfig.CompleteUpdateableFunc != null) + { + StaticConfig.CompleteUpdateableFunc(result); + } return result; } diff --git a/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarProvider.cs index 17d6aa1cd..c24b6897e 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/SugarProvider/SqlSugarProvider.cs @@ -28,6 +28,10 @@ namespace SqlSugar this.ContextID = Guid.NewGuid(); Check.ArgumentNullException(config, "config is null"); CheckDbDependency(config); + if (StaticConfig.CompleteDbFunc != null) + { + StaticConfig.CompleteDbFunc(this); + } } #endregion diff --git a/Src/Asp.Net/SqlSugar/Infrastructure/StaticConfig.cs b/Src/Asp.Net/SqlSugar/Infrastructure/StaticConfig.cs index da8f5301a..658545eee 100644 --- a/Src/Asp.Net/SqlSugar/Infrastructure/StaticConfig.cs +++ b/Src/Asp.Net/SqlSugar/Infrastructure/StaticConfig.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Text; namespace SqlSugar @@ -10,5 +11,11 @@ namespace SqlSugar public static Func Decode{ get; set; } public const string CodeFirst_BigString = "varcharmax,longtext,text,clob"; public static Func CustomSnowFlakeFunc; + + public static Action CompleteQueryableFunc; + public static Action CompleteInsertableFunc; + public static Action CompleteUpdateableFunc; + public static Action CompleteDeleteableFunc; + public static Action CompleteDbFunc; } }