From 2c6d36e58a7a858b9b9cae4f6e3358eb9f17b303 Mon Sep 17 00:00:00 2001 From: gongyc Date: Sat, 29 Nov 2025 11:31:08 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=85=AC=E5=BC=80ISnowWorker?= =?UTF-8?q?=E3=80=81SnowWorkerM1=E3=80=81SnowWorkerM2=E3=80=81SnowWorkerM3?= =?UTF-8?q?=E7=AD=89=E6=8E=A5=E5=8F=A3=E7=B1=BB=EF=BC=8C=E6=96=B9=E4=BE=BF?= =?UTF-8?q?=E7=BB=A7=E6=89=BF=E9=87=8D=E5=86=99=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- C#/source/Yitter.IdGenerator/Contract/ISnowWorker.cs | 2 +- C#/source/Yitter.IdGenerator/Core/SnowWorkerM1.cs | 2 +- C#/source/Yitter.IdGenerator/Core/SnowWorkerM2.cs | 2 +- C#/source/Yitter.IdGenerator/Core/SnowWorkerM3.cs | 2 +- C#/source/Yitter.IdGenerator/DefaultIdGenerator.cs | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/C#/source/Yitter.IdGenerator/Contract/ISnowWorker.cs b/C#/source/Yitter.IdGenerator/Contract/ISnowWorker.cs index 93d1b19..7de1ae0 100644 --- a/C#/source/Yitter.IdGenerator/Contract/ISnowWorker.cs +++ b/C#/source/Yitter.IdGenerator/Contract/ISnowWorker.cs @@ -13,7 +13,7 @@ namespace Yitter.IdGenerator { - internal interface ISnowWorker + public interface ISnowWorker { //Action GenAction { get; set; } diff --git a/C#/source/Yitter.IdGenerator/Core/SnowWorkerM1.cs b/C#/source/Yitter.IdGenerator/Core/SnowWorkerM1.cs index 07a0040..1c52a62 100644 --- a/C#/source/Yitter.IdGenerator/Core/SnowWorkerM1.cs +++ b/C#/source/Yitter.IdGenerator/Core/SnowWorkerM1.cs @@ -16,7 +16,7 @@ namespace Yitter.IdGenerator /// /// 雪花漂移算法 /// - internal class SnowWorkerM1 : ISnowWorker + public class SnowWorkerM1 : ISnowWorker { /// /// 基础时间 diff --git a/C#/source/Yitter.IdGenerator/Core/SnowWorkerM2.cs b/C#/source/Yitter.IdGenerator/Core/SnowWorkerM2.cs index 14a12f9..e7e32dd 100644 --- a/C#/source/Yitter.IdGenerator/Core/SnowWorkerM2.cs +++ b/C#/source/Yitter.IdGenerator/Core/SnowWorkerM2.cs @@ -16,7 +16,7 @@ namespace Yitter.IdGenerator /// /// 常规雪花算法 /// - internal class SnowWorkerM2 : SnowWorkerM1 + public class SnowWorkerM2 : SnowWorkerM1 { public SnowWorkerM2(IdGeneratorOptions options) : base(options) { diff --git a/C#/source/Yitter.IdGenerator/Core/SnowWorkerM3.cs b/C#/source/Yitter.IdGenerator/Core/SnowWorkerM3.cs index 4ad78a7..a2e4efe 100644 --- a/C#/source/Yitter.IdGenerator/Core/SnowWorkerM3.cs +++ b/C#/source/Yitter.IdGenerator/Core/SnowWorkerM3.cs @@ -16,7 +16,7 @@ namespace Yitter.IdGenerator /// /// 雪花漂移算法(支持数据中心ID和秒级时间戳) /// - internal class SnowWorkerM3 : SnowWorkerM1 + public class SnowWorkerM3 : SnowWorkerM1 { /// /// 数据中心ID(默认0) diff --git a/C#/source/Yitter.IdGenerator/DefaultIdGenerator.cs b/C#/source/Yitter.IdGenerator/DefaultIdGenerator.cs index ea4e2a9..89b3af5 100644 --- a/C#/source/Yitter.IdGenerator/DefaultIdGenerator.cs +++ b/C#/source/Yitter.IdGenerator/DefaultIdGenerator.cs @@ -19,7 +19,7 @@ namespace Yitter.IdGenerator /// public class DefaultIdGenerator : IIdGenerator { - private ISnowWorker _SnowWorker { get; set; } + protected virtual ISnowWorker _SnowWorker { get; set; } //public Action GenIdActionAsync //{ @@ -122,7 +122,7 @@ public DefaultIdGenerator(IdGeneratorOptions options) } - public long NewLong() + public virtual long NewLong() { return _SnowWorker.NextId(); }