diff --git a/Src/Asp.Net/SqlSugar/DistributedSystem/Snowflake/IdWorker.cs b/Src/Asp.Net/SqlSugar/DistributedSystem/Snowflake/IdWorker.cs index 6ee473ccf..347b4efda 100644 --- a/Src/Asp.Net/SqlSugar/DistributedSystem/Snowflake/IdWorker.cs +++ b/Src/Asp.Net/SqlSugar/DistributedSystem/Snowflake/IdWorker.cs @@ -71,6 +71,10 @@ namespace SqlSugar.DistributedSystem.Snowflake } public virtual long NextId() { + if (StaticConfig.CustomSnowFlakeFunc != null) + { + return StaticConfig.CustomSnowFlakeFunc(); + } lock(_lock) { var timestamp = TimeGen(); diff --git a/Src/Asp.Net/SqlSugar/Infrastructure/StaticConfig.cs b/Src/Asp.Net/SqlSugar/Infrastructure/StaticConfig.cs index 0ffac75a2..da8f5301a 100644 --- a/Src/Asp.Net/SqlSugar/Infrastructure/StaticConfig.cs +++ b/Src/Asp.Net/SqlSugar/Infrastructure/StaticConfig.cs @@ -9,5 +9,6 @@ namespace SqlSugar public static Func Encode { get; set; } public static Func Decode{ get; set; } public const string CodeFirst_BigString = "varcharmax,longtext,text,clob"; + public static Func CustomSnowFlakeFunc; } }